Class: Limited::Actor
- Inherits:
-
Object
- Object
- Limited::Actor
- Defined in:
- lib/limited/actor.rb
Defined Under Namespace
Classes: Identifier
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#num_executed ⇒ Object
Returns the value of attribute num_executed.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(identifier, values, num_executed = 0) ⇒ Actor
constructor
A new instance of Actor.
Constructor Details
#initialize(identifier, values, num_executed = 0) ⇒ Actor
Returns a new instance of Actor.
23 24 25 26 27 28 29 30 |
# File 'lib/limited/actor.rb', line 23 def initialize(identifier, values, num_executed = 0) raise ArgumentError.new("first parameter needs to be an identifier") unless identifier.is_a?(Identifier) raise ArgumentError.new("second parameter needs to be a hash of values") unless values.is_a?(Hash) raise ArgumentError.new("the values given in the second parameter needs to match with the keys of the identifier") unless identifier.keys.sort == values.keys.sort @attributes = values @num_executed = num_executed end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
20 21 22 |
# File 'lib/limited/actor.rb', line 20 def attributes @attributes end |
#num_executed ⇒ Object
Returns the value of attribute num_executed.
21 22 23 |
# File 'lib/limited/actor.rb', line 21 def num_executed @num_executed end |
Instance Method Details
#execute ⇒ Object
32 33 34 |
# File 'lib/limited/actor.rb', line 32 def execute @num_executed += 1 end |