Class: Steep::Diagnostic::Ruby::InsufficientKeywordArguments

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:, missing_keywords:) ⇒ InsufficientKeywordArguments

Returns a new instance of InsufficientKeywordArguments.



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/steep/diagnostic/ruby.rb', line 162

def initialize(node:, params:, missing_keywords:)
  send = case node.type
         when :send, :csend
           node
         when :block, :numblock
           node.children[0]
         end

  loc = if send
          send.loc.selector.with(end_pos: send.loc.expression.end_pos) # steep:ignore NoMethod
        else
          node.loc.expression
        end

  super(node: node, location: loc)

  @params = params
  @missing_keywords = missing_keywords
end

Instance Attribute Details

#method_nameObject (readonly)

Returns the value of attribute method_name.



158
159
160
# File 'lib/steep/diagnostic/ruby.rb', line 158

def method_name
  @method_name
end

#method_typeObject (readonly)

Returns the value of attribute method_type.



159
160
161
# File 'lib/steep/diagnostic/ruby.rb', line 159

def method_type
  @method_type
end

#missing_keywordsObject (readonly)

Returns the value of attribute missing_keywords.



160
161
162
# File 'lib/steep/diagnostic/ruby.rb', line 160

def missing_keywords
  @missing_keywords
end

#nodeObject (readonly)

Returns the value of attribute node.



157
158
159
# File 'lib/steep/diagnostic/ruby.rb', line 157

def node
  @node
end

Instance Method Details

#header_lineObject



182
183
184
# File 'lib/steep/diagnostic/ruby.rb', line 182

def header_line
  "More keyword arguments are required: #{missing_keywords.join(", ")}"
end