Class: Foodcritic::Gherkin::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/foodcritic/gerkin/tag.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location, name) ⇒ Tag

Returns a new instance of Tag.



9
10
11
12
# File 'lib/foodcritic/gerkin/tag.rb', line 9

def initialize(location, name)
  @location = location
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/foodcritic/gerkin/tag.rb', line 7

def name
  @name
end

Instance Method Details

#attributesObject



35
36
37
# File 'lib/foodcritic/gerkin/tag.rb', line 35

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

#commentsObject



44
45
46
47
# File 'lib/foodcritic/gerkin/tag.rb', line 44

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

#fileObject



22
23
24
# File 'lib/foodcritic/gerkin/tag.rb', line 22

def file
  location.file
end

#file_colon_lineObject



18
19
20
# File 'lib/foodcritic/gerkin/tag.rb', line 18

def file_colon_line
  location.to_s
end

#inspectObject



14
15
16
# File 'lib/foodcritic/gerkin/tag.rb', line 14

def inspect
  %{#<#{self.class} "#{name}" (#{location})>}
end

#lineObject



26
27
28
# File 'lib/foodcritic/gerkin/tag.rb', line 26

def line
  location.line
end

#locationObject



30
31
32
33
# File 'lib/foodcritic/gerkin/tag.rb', line 30

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

#multiline_argObject



49
50
51
52
# File 'lib/foodcritic/gerkin/tag.rb', line 49

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

#tagsObject



39
40
41
42
# File 'lib/foodcritic/gerkin/tag.rb', line 39

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