class RBS::Types::Function::Param

Attributes

location[R]
name[R]
type[R]

Public Class Methods

new(type:, name:, location: nil) click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 877
def initialize(type:, name:, location: nil)
  @type = type
  @name = name
  @location = location
end

Public Instance Methods

==(other) click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 883
def ==(other)
  other.is_a?(Param) && other.type == type && other.name == name
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 889
def hash
  self.class.hash ^ type.hash ^ name.hash
end
map_type() { |type| ... } click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 893
def map_type(&block)
  if block
    Param.new(name: name, type: yield(type), location: location)
  else
    enum_for :map_type
  end
end
to_json(state = _ = nil) click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 901
def to_json(state = _ = nil)
  { type: type, name: name }.to_json(state)
end
to_s() click to toggle source
# File rbs-3.6.1/lib/rbs/types.rb, line 905
def to_s
  if name
    if name.match?(/\A[a-zA-Z0-9_]+\z/)
      "#{type} #{name}"
    else
      "#{type} `#{name}`"
    end
  else
    "#{type}"
  end
end