Class: Cucumber::Core::Ast::ExamplesTable::Row

Inherits:
Object
  • Object
show all
Includes:
DescribesItself, HasLocation
Defined in:
lib/cucumber/core/ast/examples_table.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasLocation

#attributes, #comments, #file, #file_colon_line, #line, #location, #match_locations?, #multiline_arg, #tags

Methods included from DescribesItself

#describe_to

Constructor Details

#initialize(data, number, location, language) ⇒ Row

Returns a new instance of Row.

Raises:

  • (ArgumentError)


63
64
65
66
67
68
69
# File 'lib/cucumber/core/ast/examples_table.rb', line 63

def initialize(data, number, location, language)
  raise ArgumentError, data.to_s unless data.is_a?(Hash)
  @data = data
  @number = number
  @location = location
  @language = language
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



61
62
63
# File 'lib/cucumber/core/ast/examples_table.rb', line 61

def language
  @language
end

#numberObject (readonly)

Returns the value of attribute number.



61
62
63
# File 'lib/cucumber/core/ast/examples_table.rb', line 61

def number
  @number
end

Instance Method Details

#==(other) ⇒ Object



71
72
73
74
75
76
# File 'lib/cucumber/core/ast/examples_table.rb', line 71

def ==(other)
  return false unless other.class == self.class
  other.number == number &&
    other.location == location &&
    other.data == data
end

#expand(string) ⇒ Object



82
83
84
85
86
87
88
# File 'lib/cucumber/core/ast/examples_table.rb', line 82

def expand(string)
  result = string.dup
  @data.each do |key, value|
    result.gsub!("<#{key}>", value.to_s)
  end
  result
end

#inspectObject



90
91
92
# File 'lib/cucumber/core/ast/examples_table.rb', line 90

def inspect
  "#{self.class}: #{@data.inspect}"
end

#valuesObject



78
79
80
# File 'lib/cucumber/core/ast/examples_table.rb', line 78

def values
  @data.values
end