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

Instance Method Summary collapse

Instance Method Details

#attributesObject



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

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

#commentsObject



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

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

#fileObject



102
103
104
# File 'lib/cucumber/core/ast/location.rb', line 102

def file
  location.file
end

#file_colon_lineObject



98
99
100
# File 'lib/cucumber/core/ast/location.rb', line 98

def file_colon_line
  location.to_s
end

#lineObject



106
107
108
# File 'lib/cucumber/core/ast/location.rb', line 106

def line
  location.line
end

#locationObject



110
111
112
113
# File 'lib/cucumber/core/ast/location.rb', line 110

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

#match_locations?(queried_locations) ⇒ Boolean

Returns:

  • (Boolean)


115
116
117
118
# File 'lib/cucumber/core/ast/location.rb', line 115

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



134
135
136
137
# File 'lib/cucumber/core/ast/location.rb', line 134

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

#tagsObject



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

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