Class: Lavin::Runner::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/lavin/runner.rb

Defined Under Namespace

Classes: DepletedError

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#countObject

Returns the value of attribute count.



17
18
19
# File 'lib/lavin/runner.rb', line 17

def count
  @count
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/lavin/runner.rb', line 16

def name
  @name
end

#personaObject (readonly)

Returns the value of attribute persona.



16
17
18
# File 'lib/lavin/runner.rb', line 16

def persona
  @persona
end

Instance Method Details

#getObject

Raises:



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

Returns:

  • (Boolean)


25
26
27
# File 'lib/lavin/runner.rb', line 25

def present?
  count.positive?
end