Class: Cucumber::UsualSuspects::Identity
- Inherits:
-
Object
- Object
- Cucumber::UsualSuspects::Identity
- Defined in:
- lib/cucumber/usual_suspects/identity.rb
Instance Method Summary collapse
- #as(regexp, &block) ⇒ Object
-
#initialize(transforms_registry, description, definition) ⇒ Identity
constructor
A new instance of Identity.
- #regexp_string ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(transforms_registry, description, definition) ⇒ Identity
Returns a new instance of Identity.
4 5 6 7 |
# File 'lib/cucumber/usual_suspects/identity.rb', line 4 def initialize(transforms_registry, description, definition) @transforms_registry, @description = transforms_registry, description instance_exec(&definition) end |
Instance Method Details
#as(regexp, &block) ⇒ Object
9 10 11 |
# File 'lib/cucumber/usual_suspects/identity.rb', line 9 def as(regexp, &block) transforms << @transforms_registry.register_rb_transform(regexp, block) end |
#regexp_string ⇒ Object
17 18 19 |
# File 'lib/cucumber/usual_suspects/identity.rb', line 17 def regexp_string @transforms.map{ |t| t.to_s }.join("|") end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/cucumber/usual_suspects/identity.rb', line 13 def to_s @description end |