Class: RBI::Visibility Abstract

Inherits:
NodeWithComments show all
Defined in:
lib/rbi/model.rb

Overview

This class is abstract.

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, #comments?, #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: nil) ⇒ Visibility

: (Symbol visibility, ?loc: Loc?, ?comments: Array?) -> void



890
891
892
893
# File 'lib/rbi/model.rb', line 890

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

Instance Attribute Details

#visibilityObject (readonly)

: Symbol



887
888
889
# File 'lib/rbi/model.rb', line 887

def visibility
  @visibility
end

Instance Method Details

#==(other) ⇒ Object

: (Object? other) -> bool



896
897
898
899
900
# File 'lib/rbi/model.rb', line 896

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

  visibility == other.visibility
end

#private?Boolean

: -> bool

Returns:

  • (Boolean)


913
914
915
# File 'lib/rbi/model.rb', line 913

def private?
  visibility == :private
end

#protected?Boolean

: -> bool

Returns:

  • (Boolean)


908
909
910
# File 'lib/rbi/model.rb', line 908

def protected?
  visibility == :protected
end

#public?Boolean

: -> bool

Returns:

  • (Boolean)


903
904
905
# File 'lib/rbi/model.rb', line 903

def public?
  visibility == :public
end