class CukeSalad::Actor

Public Class Methods

new(this_type_of_role, directed_by=Director.new) click to toggle source
# File lib/cukesalad/actor.rb, line 6
def initialize this_type_of_role, directed_by=Director.new
  @director = directed_by
  @note_pad = {}
  get_into_character_for this_type_of_role
end

Public Instance Methods

answer(described_task, details = {})
Alias for: perform
get_into_character_for(described_role) click to toggle source
# File lib/cukesalad/actor.rb, line 19
def get_into_character_for described_role
  the_role = @director.explain_the_role described_role
  see_how_to_do the_role
  role_preparation
end
get_ready_to_perform(something) click to toggle source
# File lib/cukesalad/actor.rb, line 25
def get_ready_to_perform something
  the_thing = @director.how_do_i_perform something
  see_how_to_do the_thing
end
perform(described_task, details = {}) click to toggle source
# File lib/cukesalad/actor.rb, line 12
def perform described_task, details = {}
  get_ready_to_perform described_task
  @info = details
  perform_task
end
Also aliased as: answer
recall(key) click to toggle source
# File lib/cukesalad/actor.rb, line 47
def recall key
  begin
    @note_pad.fetch key
  rescue KeyError
    raise KeyError, "You tried to recall ':#{key}' but no previous step appears to have taken note of that information."
  end
end
role_preparation() click to toggle source
# File lib/cukesalad/actor.rb, line 35
def role_preparation
  # Does nothing unless you override it from your role
end
see_how_to(something)
Alias for: see_how_to_do
see_how_to_do(something) click to toggle source
# File lib/cukesalad/actor.rb, line 30
def see_how_to_do something
  extend something
end
Also aliased as: see_how_to
take_note_of(key, value) click to toggle source
# File lib/cukesalad/actor.rb, line 43
def take_note_of key, value
 @note_pad.store key, value
end
value_of(symbol) click to toggle source
# File lib/cukesalad/actor.rb, line 39
def value_of(symbol)
  @info[symbol]
end