Created
July 17, 2013 10:47
-
-
Save eLafo/6019528 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SamyRoad | |
module Redis | |
module Objects | |
extend ActiveSupport::Concern | |
included do | |
include ::Redis::Objects | |
end | |
module ClassMethods | |
def has_counter(name, options = {}) | |
counter_name = name.to_s + "_counter" | |
method_name = name.to_s + "_count" | |
counter(counter_name, options) | |
define_method method_name do | |
send(counter_name).value | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment