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.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/cucumber/wire/step_definition.rb', line 10

def initialize(connection, data, registry)
  @connection = connection
  @registry = registry
  @id = data['id']
  @regexp_source = begin
    Regexp.new(data['regexp'])
  rescue StandardError
    data['regexp'] || 'Unknown'
  end
  @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.



8
9
10
# File 'lib/cucumber/wire/step_definition.rb', line 8

def expression
  @expression
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/cucumber/wire/step_definition.rb', line 8

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



8
9
10
# File 'lib/cucumber/wire/step_definition.rb', line 8

def location
  @location
end

#regexp_sourceObject (readonly)

Returns the value of attribute regexp_source.



8
9
10
# File 'lib/cucumber/wire/step_definition.rb', line 8

def regexp_source
  @regexp_source
end

#registryObject (readonly)

Returns the value of attribute registry.



8
9
10
# File 'lib/cucumber/wire/step_definition.rb', line 8

def registry
  @registry
end

Instance Method Details

#invoke(args) ⇒ Object



23
24
25
# File 'lib/cucumber/wire/step_definition.rb', line 23

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