Class: Gurke::StepDefinition
- Inherits:
-
Object
- Object
- Gurke::StepDefinition
- Defined in:
- lib/gurke/step_definition.rb
Defined Under Namespace
Classes: Match
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Instance Method Summary collapse
-
#initialize(pattern, opts = {}) ⇒ StepDefinition
constructor
A new instance of StepDefinition.
- #match(name, type = :any) ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(pattern, opts = {}) ⇒ StepDefinition
Returns a new instance of StepDefinition.
5 6 7 8 |
# File 'lib/gurke/step_definition.rb', line 5 def initialize(pattern, opts = {}) @pattern = pattern @opts = opts end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
3 4 5 |
# File 'lib/gurke/step_definition.rb', line 3 def method_name @method_name end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
3 4 5 |
# File 'lib/gurke/step_definition.rb', line 3 def opts @opts end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
3 4 5 |
# File 'lib/gurke/step_definition.rb', line 3 def pattern @pattern end |
Instance Method Details
#match(name, type = :any) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/gurke/step_definition.rb', line 18 def match(name, type = :any) return if self.type != :any && self.type != type return if pattern.is_a?(String) && name != pattern match = pattern.match(name) return unless match Match.new(method_name, match.to_a[1..-1]) end |
#type ⇒ Object
14 15 16 |
# File 'lib/gurke/step_definition.rb', line 14 def type opts[:type] || :any end |