Class: RBI::Visibility
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::Visibility
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/rbi/model.rb,
lib/rbi/printer.rb
Overview
Visibility
Instance Attribute Summary collapse
-
#visibility ⇒ Object
readonly
Returns the value of attribute visibility.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
- #==(other) ⇒ Object
- #accept_printer(v) ⇒ Object
-
#initialize(visibility, loc: nil, comments: []) ⇒ Visibility
constructor
A new instance of Visibility.
- #private? ⇒ Boolean
- #protected? ⇒ Boolean
- #public? ⇒ Boolean
Methods inherited from NodeWithComments
#annotations, #merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #print_blank_line_before, #replace, #string
Constructor Details
#initialize(visibility, loc: nil, comments: []) ⇒ Visibility
Returns a new instance of Visibility.
843 844 845 846 |
# File 'lib/rbi/model.rb', line 843 def initialize(visibility, loc: nil, comments: []) super(loc: loc, comments: comments) @visibility = visibility end |
Instance Attribute Details
#visibility ⇒ Object (readonly)
Returns the value of attribute visibility.
840 841 842 |
# File 'lib/rbi/model.rb', line 840 def visibility @visibility end |
Instance Method Details
#==(other) ⇒ Object
849 850 851 |
# File 'lib/rbi/model.rb', line 849 def ==(other) visibility == other.visibility end |
#accept_printer(v) ⇒ Object
549 550 551 552 553 554 555 |
# File 'lib/rbi/printer.rb', line 549 def accept_printer(v) print_blank_line_before(v) v.printl("# #{loc}") if loc && v.print_locs v.visit_all(comments) v.printl(visibility.to_s) end |
#private? ⇒ Boolean
864 865 866 |
# File 'lib/rbi/model.rb', line 864 def private? visibility == :private end |
#protected? ⇒ Boolean
859 860 861 |
# File 'lib/rbi/model.rb', line 859 def protected? visibility == :protected end |
#public? ⇒ Boolean
854 855 856 |
# File 'lib/rbi/model.rb', line 854 def public? visibility == :public end |