Module: Cucumber::Core::Ast::HasLocation

Instance Method Summary collapse

Instance Method Details

#attributesObject



142
143
144
# File 'lib/cucumber/core/ast/location.rb', line 142

def attributes
  [tags, comments, multiline_arg].flatten
end

#commentsObject



151
152
153
154
# File 'lib/cucumber/core/ast/location.rb', line 151

def comments
  # will be overriden by nodes that actually have comments
  []
end

#fileObject



124
125
126
# File 'lib/cucumber/core/ast/location.rb', line 124

def file
  location.file
end

#file_colon_lineObject



120
121
122
# File 'lib/cucumber/core/ast/location.rb', line 120

def file_colon_line
  location.to_s
end

#lineObject



128
129
130
# File 'lib/cucumber/core/ast/location.rb', line 128

def line
  location.line
end

#locationObject



132
133
134
135
# File 'lib/cucumber/core/ast/location.rb', line 132

def location
  raise('Please set @location in the constructor') unless defined?(@location)
  @location
end

#match_locations?(queried_locations) ⇒ Boolean

Returns:

  • (Boolean)


137
138
139
140
# File 'lib/cucumber/core/ast/location.rb', line 137

def match_locations?(queried_locations)
  return true if attributes.any? { |node| node.match_locations? queried_locations }
  queried_locations.any? { |queried_location| queried_location.match? location }
end

#multiline_argObject



156
157
158
159
# File 'lib/cucumber/core/ast/location.rb', line 156

def multiline_arg
  # will be overriden by nodes that actually have a multiline_argument
  EmptyMultilineArgument.new
end

#tagsObject



146
147
148
149
# File 'lib/cucumber/core/ast/location.rb', line 146

def tags
  # will be overriden by nodes that actually have tags
  []
end