Class: RBI::SigParam

Inherits:
Node
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/rbi/model.rb,
lib/rbi/printer.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from Node

#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string

Constructor Details

#initialize(name, type, loc: nil) ⇒ SigParam

Returns a new instance of SigParam.



686
687
688
689
690
# File 'lib/rbi/model.rb', line 686

def initialize(name, type, loc: nil)
  super(loc: loc)
  @name = name
  @type = type
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



683
684
685
# File 'lib/rbi/model.rb', line 683

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



683
684
685
# File 'lib/rbi/model.rb', line 683

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



693
694
695
# File 'lib/rbi/model.rb', line 693

def ==(other)
  other.is_a?(SigParam) && name == other.name && type == other.type
end

#accept_printer(v) ⇒ Object



544
545
546
# File 'lib/rbi/printer.rb', line 544

def accept_printer(v)
  v.print("#{name}: #{type}")
end