Class: VisitCounter::Key
- Inherits:
-
Object
- Object
- VisitCounter::Key
- Defined in:
- lib/visit_counter_updater/key.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Class Method Summary collapse
Instance Method Summary collapse
- #generate_from_instance ⇒ Object
-
#initialize(object, method) ⇒ Key
constructor
A new instance of Key.
- #object_class ⇒ Object
Constructor Details
#initialize(object, method) ⇒ Key
Returns a new instance of Key.
5 6 7 8 |
# File 'lib/visit_counter_updater/key.rb', line 5 def initialize(object, method) @object = object @method = method end |
Instance Attribute Details
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/visit_counter_updater/key.rb', line 4 def method @method end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
4 5 6 |
# File 'lib/visit_counter_updater/key.rb', line 4 def object @object end |
Class Method Details
.generate(method, obj_class, obj_id = nil) ⇒ Object
10 11 12 |
# File 'lib/visit_counter_updater/key.rb', line 10 def self.generate(method, obj_class, obj_id = nil) ["visit_counter", obj_class, obj_id, method].compact.join("::") end |
Instance Method Details
#generate_from_instance ⇒ Object
14 15 16 17 |
# File 'lib/visit_counter_updater/key.rb', line 14 def generate_from_instance object_class = self.object_class Key.generate(method,object_class, self.object.id) end |
#object_class ⇒ Object
19 20 21 |
# File 'lib/visit_counter_updater/key.rb', line 19 def object_class object.class.to_s end |