In Files

  • rbs-1.0.4/lib/rbs/types.rb

Class/Module Index [+]

Quicksearch

RBS::Types::Function::Param

Attributes

name[R]
type[R]

Public Class Methods

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

Public Instance Methods

==(other) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 668
def ==(other)
  other.is_a?(Param) && other.type == type && other.name == name
end
            
Also aliased as: eql?
eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 674
def hash
  self.class.hash ^ type.hash ^ name.hash
end
            
map_type(&block) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 678
def map_type(&block)
  if block
    Param.new(name: name, type: yield(type))
  else
    enum_for :map_type
  end
end
            
to_json(*a) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 686
def to_json(*a)
  { type: type, name: name }.to_json(*a)
end
            
to_s() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 690
def to_s
  if name
    if /\A#{Parser::KEYWORDS_RE}\z/.match?(name)
      "#{type} `#{name}`"
    else
      "#{type} #{name}"
    end
  else
    "#{type}"
  end
end