Class: Cucumber::Wire::StepDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/wire/step_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection, data, registry) ⇒ StepDefinition

Returns a new instance of StepDefinition.



8
9
10
11
12
13
14
15
# File 'lib/cucumber/wire/step_definition.rb', line 8

def initialize(connection, data, registry)
  @connection = connection
  @registry   = registry
  @id              = data['id']
  @regexp_source   = Regexp.new(data['regexp']) rescue data['regexp'] || "Unknown"
  @expression      = registry.create_expression(@regexp_source)
  @location        = Core::Test::Location.from_file_colon_line(data['source'] || "unknown:0")
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



6
7
8
# File 'lib/cucumber/wire/step_definition.rb', line 6

def expression
  @expression
end

#locationObject (readonly)

Returns the value of attribute location.



6
7
8
# File 'lib/cucumber/wire/step_definition.rb', line 6

def location
  @location
end

#regexp_sourceObject (readonly)

Returns the value of attribute regexp_source.



6
7
8
# File 'lib/cucumber/wire/step_definition.rb', line 6

def regexp_source
  @regexp_source
end

#registryObject (readonly)

Returns the value of attribute registry.



6
7
8
# File 'lib/cucumber/wire/step_definition.rb', line 6

def registry
  @registry
end

Instance Method Details

#invoke(args) ⇒ Object



17
18
19
# File 'lib/cucumber/wire/step_definition.rb', line 17

def invoke(args)
  @connection.invoke(@id, args)
end