Class: CukeSalad::Director

Inherits:
Object
  • Object
show all
Includes:
Codify
Defined in:
lib/cukesalad/director.rb

Instance Method Summary collapse

Instance Method Details

#explain_the_role(description) ⇒ Object

TODO: Needs refactoring



8
9
10
11
12
13
14
15
# File 'lib/cukesalad/director.rb', line 8

def explain_the_role description
  name = ConstName.from description
  begin
    find_directives_for name
  rescue NameError
    raise "I can't find a role called '#{ name }'. Have you created it?\ne.g.\n  module #{ name }\n  end\n\n"
  end
end

#find_directives_for(something) ⇒ Object



26
27
28
# File 'lib/cukesalad/director.rb', line 26

def find_directives_for something
  Kernel.const_get( something )
end

#how_do_i_perform(something) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/cukesalad/director.rb', line 17

def how_do_i_perform something
  name = ConstName.from something
  begin
    find_directives_for name
  rescue NameError
    raise "I can't find a task called '#{ something }'. Have you created it?\ne.g.\n  in_order_to '#{ something }' do\n    raise \"TODO: You need to explain how to '#{ something }'\"\n  end\n\n" 
  end
end