Exception: Liquor::ArgumentTypeError

Inherits:
Error show all
Defined in:
lib/liquor/diagnostics.rb

Instance Attribute Summary collapse

Attributes inherited from Diagnostic

#raw_message

Instance Method Summary collapse

Methods inherited from Error

#error?

Methods inherited from Diagnostic

#as_json, #decorate, #error?, #tabify_column, #to_json

Constructor Details

#initialize(message, location = nil) ⇒ ArgumentTypeError

Returns a new instance of ArgumentTypeError


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/liquor/diagnostics.rb', line 111

def initialize(message, location=nil)
  location_info = ""
  if location
    if location.include? :function
      location_info << "function `#{location[:function]}'"
      if location.include? :argument
        if location[:argument].nil?
          location_info << ", unnamed argument"
        else
          location_info << ", argument `#{location[:argument]}'"
        end
      end
    end
  end

  if location_info.empty?
    super(message, location)
  else
    super("#{message} at #{location_info}", location)
  end
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location


109
110
111
# File 'lib/liquor/diagnostics.rb', line 109

def location
  @location
end