Class: Cucumber::UsualSuspects::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/usual_suspects/identity.rb

Instance Method Summary collapse

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_stringObject



17
18
19
# File 'lib/cucumber/usual_suspects/identity.rb', line 17

def regexp_string
  @transforms.map{ |t| t.to_s }.join("|")
end

#to_sObject



13
14
15
# File 'lib/cucumber/usual_suspects/identity.rb', line 13

def to_s
  @description
end