Module: Countable
- Extended by:
- Decoratable
- Defined in:
- lib/decoratable/countable.rb
Defined Under Namespace
Modules: Helper
Instance Method Summary collapse
Methods included from Decoratable
Instance Method Details
#countable ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/decoratable/countable.rb', line 16 def countable key = :"#{__decorated_method__.name}_call_count" Helper.define_reader(self, key) instance_variable = :"@#{key}" count = instance_variable_get(instance_variable).to_i instance_variable_set(instance_variable, count + 1) yield end |