Class: RBI::Visibility

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

Overview

Visibility

Direct Known Subclasses

Private, Protected, Public

Instance Attribute Summary collapse

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, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string

Constructor Details

#initialize(visibility, loc: nil, comments: []) ⇒ Visibility

Returns a new instance of Visibility.



926
927
928
929
# File 'lib/rbi/model.rb', line 926

def initialize(visibility, loc: nil, comments: [])
  super(loc: loc, comments: comments)
  @visibility = visibility
end

Instance Attribute Details

#visibilityObject (readonly)

Returns the value of attribute visibility.



923
924
925
# File 'lib/rbi/model.rb', line 923

def visibility
  @visibility
end

Instance Method Details

#==(other) ⇒ Object



932
933
934
935
936
# File 'lib/rbi/model.rb', line 932

def ==(other)
  return false unless other.is_a?(Visibility)

  visibility == other.visibility
end

#private?Boolean

Returns:

  • (Boolean)


949
950
951
# File 'lib/rbi/model.rb', line 949

def private?
  visibility == :private
end

#protected?Boolean

Returns:

  • (Boolean)


944
945
946
# File 'lib/rbi/model.rb', line 944

def protected?
  visibility == :protected
end

#public?Boolean

Returns:

  • (Boolean)


939
940
941
# File 'lib/rbi/model.rb', line 939

def public?
  visibility == :public
end