Class: Cucumber::RbSupport::RbLanguage
Overview
The Ruby implementation of the programming language API.
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#begin_rb_scenario(scenario) ⇒ Object
-
#begin_scenario(scenario) ⇒ Object
-
#build_rb_world_factory(world_modules, proc) ⇒ Object
-
#end_scenario ⇒ Object
-
#initialize(runtime) ⇒ RbLanguage
constructor
A new instance of RbLanguage.
-
#load_code_file(code_file) ⇒ Object
-
#register_rb_hook(phase, tag_expressions, proc) ⇒ Object
-
#register_rb_step_definition(regexp, proc_or_sym, options) ⇒ Object
-
#register_rb_transform(regexp, proc) ⇒ Object
-
#snippet_text(code_keyword, step_name, multiline_arg, snippet_type = :regexp) ⇒ Object
-
#step_matches(name_to_match, name_to_format) ⇒ Object
#add_hook, #add_transform, #after_configuration, #available_step_definition, #clear_hooks, #execute_transforms, #hooks_for, #invoked_step_definition, #unmatched_step_definitions
Constructor Details
#initialize(runtime) ⇒ RbLanguage
Returns a new instance of RbLanguage.
42
43
44
45
46
47
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 42
def initialize(runtime)
@runtime = runtime
@step_definitions = []
RbDsl.rb_language = self
@world_proc = @world_modules = nil
end
|
Instance Attribute Details
#current_world ⇒ Object
Returns the value of attribute current_world.
35
36
37
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 35
def current_world
@current_world
end
|
#step_definitions ⇒ Object
Returns the value of attribute step_definitions.
35
36
37
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 35
def step_definitions
@step_definitions
end
|
Instance Method Details
#begin_rb_scenario(scenario) ⇒ Object
64
65
66
67
68
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 64
def begin_rb_scenario(scenario)
create_world
extend_world
connect_world(scenario)
end
|
#begin_scenario(scenario) ⇒ Object
97
98
99
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 97
def begin_scenario(scenario)
begin_rb_scenario(scenario)
end
|
#build_rb_world_factory(world_modules, proc) ⇒ Object
84
85
86
87
88
89
90
91
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 84
def build_rb_world_factory(world_modules, proc)
if(proc)
raise MultipleWorld.new(@world_proc, proc) if @world_proc
@world_proc = proc
end
@world_modules ||= []
@world_modules += world_modules
end
|
#end_scenario ⇒ Object
101
102
103
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 101
def end_scenario
@current_world = nil
end
|
#load_code_file(code_file) ⇒ Object
93
94
95
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 93
def load_code_file(code_file)
load File.expand_path(code_file) end
|
#register_rb_hook(phase, tag_expressions, proc) ⇒ Object
70
71
72
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 70
def register_rb_hook(phase, tag_expressions, proc)
add_hook(phase, RbHook.new(self, tag_expressions, proc))
end
|
#register_rb_step_definition(regexp, proc_or_sym, options) ⇒ Object
78
79
80
81
82
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 78
def register_rb_step_definition(regexp, proc_or_sym, options)
step_definition = RbStepDefinition.new(self, regexp, proc_or_sym, options)
@step_definitions << step_definition
step_definition
end
|
#snippet_text(code_keyword, step_name, multiline_arg, snippet_type = :regexp) ⇒ Object
59
60
61
62
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 59
def snippet_text(code_keyword, step_name, multiline_arg, snippet_type = :regexp)
snippet_class = typed_snippet_class(snippet_type)
snippet_class.new(code_keyword, step_name, multiline_arg).to_s
end
|
#step_matches(name_to_match, name_to_format) ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/cucumber/rb_support/rb_language.rb', line 49
def step_matches(name_to_match, name_to_format)
@step_definitions.map do |step_definition|
if(arguments = step_definition.arguments_from(name_to_match))
StepMatch.new(step_definition, name_to_match, name_to_format, arguments)
else
nil
end
end.compact
end
|