Class: Spec::Story::Step
- Defined in:
- lib/gems/rspec-1.1.12/lib/spec/story/step.rb
Constant Summary collapse
- PARAM_PATTERN =
/([^\\]|^)(\$(?!\$)\w*)/
- PARAM_OR_GROUP_PATTERN =
/(\$(?!\$)\w*)|\(.*?\)/
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Step
constructor
A new instance of Step.
- #matches?(name) ⇒ Boolean
- #parse_args(name) ⇒ Object
- #perform(instance, *args) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Step
Returns a new instance of Step.
9 10 11 12 13 |
# File 'lib/gems/rspec-1.1.12/lib/spec/story/step.rb', line 9 def initialize(name, &block) init_name(name) init_expression(name) block_given? ? init_module(name, &block) : set_pending end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/gems/rspec-1.1.12/lib/spec/story/step.rb', line 7 def name @name end |
Instance Method Details
#matches?(name) ⇒ Boolean
21 22 23 |
# File 'lib/gems/rspec-1.1.12/lib/spec/story/step.rb', line 21 def matches?(name) !(name.strip =~ @expression).nil? end |
#parse_args(name) ⇒ Object
25 26 27 |
# File 'lib/gems/rspec-1.1.12/lib/spec/story/step.rb', line 25 def parse_args(name) name.strip.match(@expression)[1..-1] end |
#perform(instance, *args) ⇒ Object
15 16 17 18 19 |
# File 'lib/gems/rspec-1.1.12/lib/spec/story/step.rb', line 15 def perform(instance, *args) raise Spec::Example::ExamplePendingError.new("Not Yet Implemented") if pending? instance.extend(@mod) instance.__send__(sanitize(@name), *args) end |