Class: Lavin::Runner::Entry
- Inherits:
-
Object
- Object
- Lavin::Runner::Entry
- Defined in:
- lib/lavin/runner.rb
Defined Under Namespace
Classes: DepletedError
Instance Attribute Summary collapse
-
#count ⇒ Object
Returns the value of attribute count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#persona ⇒ Object
readonly
Returns the value of attribute persona.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(persona) ⇒ Entry
constructor
A new instance of Entry.
- #present? ⇒ Boolean
Constructor Details
#initialize(persona) ⇒ Entry
Returns a new instance of Entry.
19 20 21 22 23 |
# File 'lib/lavin/runner.rb', line 19 def initialize(persona) @persona = persona @name = persona.config[:name] @count = persona.user_count end |
Instance Attribute Details
#count ⇒ Object
Returns the value of attribute count.
17 18 19 |
# File 'lib/lavin/runner.rb', line 17 def count @count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/lavin/runner.rb', line 16 def name @name end |
#persona ⇒ Object (readonly)
Returns the value of attribute persona.
16 17 18 |
# File 'lib/lavin/runner.rb', line 16 def persona @persona end |
Instance Method Details
#get ⇒ Object
29 30 31 32 33 34 |
# File 'lib/lavin/runner.rb', line 29 def get raise DepletedError unless present? self.count -= 1 persona end |
#present? ⇒ Boolean
25 26 27 |
# File 'lib/lavin/runner.rb', line 25 def present? count.positive? end |