Class: RBI::KwOptParam

Inherits:
Param show all
Extended by:
T::Sig
Defined in:
lib/rbi/model.rb

Instance Attribute Summary collapse

Attributes inherited from Param

#name

Attributes inherited from NodeWithComments

#comments

Attributes inherited from Node

#loc, #parent_tree

Instance Method Summary collapse

Methods inherited from NodeWithComments

#annotations, #merge_with, #version_requirements

Methods inherited from Node

#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #replace, #satisfies_version?, #string

Constructor Details

#initialize(name, value, loc: nil, comments: [], &block) ⇒ KwOptParam

Returns a new instance of KwOptParam.



772
773
774
775
776
# File 'lib/rbi/model.rb', line 772

def initialize(name, value, loc: nil, comments: [], &block)
  super(name, loc: loc, comments: comments)
  @value = value
  block&.call(self)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



761
762
763
# File 'lib/rbi/model.rb', line 761

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



784
785
786
# File 'lib/rbi/model.rb', line 784

def ==(other)
  KwOptParam === other && name == other.name
end

#to_sObject



779
780
781
# File 'lib/rbi/model.rb', line 779

def to_s
  "#{name}:"
end