Class: Steep::Diagnostic::Ruby::InsufficientPositionalArguments

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:) ⇒ InsufficientPositionalArguments

Returns a new instance of InsufficientPositionalArguments.



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/steep/diagnostic/ruby.rb', line 111

def initialize(node:, params:)
  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
end

Instance Attribute Details

#nodeObject (readonly)

Returns the value of attribute node.



108
109
110
# File 'lib/steep/diagnostic/ruby.rb', line 108

def node
  @node
end

#paramsObject (readonly)

Returns the value of attribute params.



109
110
111
# File 'lib/steep/diagnostic/ruby.rb', line 109

def params
  @params
end

Instance Method Details

#header_lineObject



129
130
131
# File 'lib/steep/diagnostic/ruby.rb', line 129

def header_line
  "More positional arguments are required"
end