Class: Error

Inherits:
Object
  • Object
show all
Defined in:
lib/gherkin_language/error.rb

Overview

This value entity class represents a language error

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category, context, issuetype, message, replacements, rule, from_y, to_y) ⇒ Error

Returns a new instance of Error.



19
20
21
22
23
24
25
26
27
28
# File 'lib/gherkin_language/error.rb', line 19

def initialize(category, context, issuetype, message, replacements, rule, from_y, to_y)
  @category = category
  @context = context
  @issuetype = issuetype
  @message = message
  @replacements = replacements
  @rule = rule
  @from_y = from_y
  @to_y = to_y
end

Instance Attribute Details

#categoryObject

Returns the value of attribute category.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def category
  @category
end

#contextObject

Returns the value of attribute context.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def context
  @context
end

#from_yObject

Returns the value of attribute from_y.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def from_y
  @from_y
end

#issuetypeObject

Returns the value of attribute issuetype.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def issuetype
  @issuetype
end

#messageObject

Returns the value of attribute message.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def message
  @message
end

#replacementsObject

Returns the value of attribute replacements.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def replacements
  @replacements
end

#ruleObject

Returns the value of attribute rule.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def rule
  @rule
end

#to_yObject

Returns the value of attribute to_y.



17
18
19
# File 'lib/gherkin_language/error.rb', line 17

def to_y
  @to_y
end

Instance Method Details

#str(references) ⇒ Object



30
31
32
33
# File 'lib/gherkin_language/error.rb', line 30

def str(references)
  (red("[#{@issuetype}] #{@rule}\n") +
   "  #{@message}\n  Context: #{@context}\n  Replacements: #{@replacements}\n  References: #{references * ', '}\n")
end