Class: Wakame::ConstantCounter
- Inherits:
-
InstanceCounter
- Object
- InstanceCounter
- Wakame::ConstantCounter
- Defined in:
- lib/wakame/instance_counter.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Method Summary collapse
-
#initialize(resource) ⇒ ConstantCounter
constructor
A new instance of ConstantCounter.
- #instance_count ⇒ Object
- #instance_count=(count) ⇒ Object
Methods inherited from InstanceCounter
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Constructor Details
#initialize(resource) ⇒ ConstantCounter
Returns a new instance of ConstantCounter.
27 28 29 30 |
# File 'lib/wakame/instance_counter.rb', line 27 def initialize(resource) @instance_count = 1 bind_resource(resource) end |
Instance Method Details
#instance_count ⇒ Object
32 33 34 |
# File 'lib/wakame/instance_counter.rb', line 32 def instance_count @instance_count end |
#instance_count=(count) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/wakame/instance_counter.rb', line 36 def instance_count=(count) raise OutOfLimitRangeError unless check_hard_limit(count) if @instance_count != count prev = @instance_count @instance_count = count ED.fire_event(Event::InstanceCountChanged.new(@resource, prev, count)) end end |