Class: Steep::Diagnostic::Ruby::UnexpectedKeywordArgument

Inherits:
Base
  • Object
show all
Defined in:
lib/steep/diagnostic/ruby.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#detail_lines, #diagnostic_code

Methods included from Helper

#error_name, #full_message

Constructor Details

#initialize(node:, params:) ⇒ UnexpectedKeywordArgument

Returns a new instance of UnexpectedKeywordArgument.



138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/steep/diagnostic/ruby.rb', line 138

def initialize(node:, params:)
  loc = case node.type
        when :pair
          node.children[0].location.expression
        when :kwsplat
          node.location.expression
        else
          raise
        end
  super(node: node, location: loc)
  @params = params
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



135
136
137
# File 'lib/steep/diagnostic/ruby.rb', line 135

def node
  @node
end

#paramsObject (readonly)

Returns the value of attribute params.



136
137
138
# File 'lib/steep/diagnostic/ruby.rb', line 136

def params
  @params
end

Instance Method Details

#header_lineObject



151
152
153
# File 'lib/steep/diagnostic/ruby.rb', line 151

def header_line
  "Unexpected keyword argument"
end