From 2d17b585111f24ff047847d4d2cc33bbdde2fa69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Villeneuve?= Date: Fri, 8 Dec 2023 15:19:16 +0100 Subject: [PATCH] Improved documentation --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f06f79c..e7686c6 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,9 @@ end This will simply increment the counter every time a `User` is created. ```ruby +# Define a class, and include the Statisfy::Counter module +# You can put this class anywhere you want, as long as it is loaded by the initializer +# See the Installation section for more details class UsersCreated include Statisfy::Counter @@ -77,11 +80,11 @@ UsersCreated.value(month: Time.now) # By default it returns the last 24 months UsersCreated.values_grouped_by_month(stop_at: Time.now.last_month.end_of_month, start_at: Time.now.last_year) # => -# [ -# { month: "2023-01", value: 766 }, -# { month: "2023-02", value: 1246 }, -# ... -# ] +# { +# "2023/01", value: 766, +# "2023/02", value: 1246, +# ... +# } ``` ### Defining a counter with a scope