Exception: RBS::InvalidTypeApplicationError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rbs/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_name:, args:, params:, location:) ⇒ InvalidTypeApplicationError

Returns a new instance of InvalidTypeApplicationError.



8
9
10
11
12
13
14
# File 'lib/rbs/errors.rb', line 8

def initialize(type_name:, args:, params:, location:)
  @type_name = type_name
  @args = args
  @params = params
  @location = location
  super "#{Location.to_string location}: #{type_name} expects parameters [#{params.each.map(&:name).join(", ")}], but given args [#{args.join(", ")}]"
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/rbs/errors.rb', line 4

def args
  @args
end

#locationObject (readonly)

Returns the value of attribute location.



6
7
8
# File 'lib/rbs/errors.rb', line 6

def location
  @location
end

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/rbs/errors.rb', line 5

def params
  @params
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



3
4
5
# File 'lib/rbs/errors.rb', line 3

def type_name
  @type_name
end

Class Method Details

.check!(type_name:, args:, params:, location:) ⇒ Object



16
17
18
19
20
# File 'lib/rbs/errors.rb', line 16

def self.check!(type_name:, args:, params:, location:)
  unless args.size == params.size
    raise new(type_name: type_name, args: args, params: params, location: location)
  end
end