Class: RBI::Visibility
Overview
Instance Attribute Summary collapse
#comments
Attributes inherited from Node
#loc, #parent_tree
Instance Method Summary
collapse
#merge_with, #oneline?
Methods inherited from Node
#compatible_with?, #detach, #group_kind, #merge_with, #oneline?, #parent_conflict_tree, #parent_scope, #print, #replace, #string
Constructor Details
#initialize(visibility, loc: nil, comments: []) ⇒ Visibility
Returns a new instance of Visibility.
830
831
832
833
|
# File 'lib/rbi/model.rb', line 830
def initialize(visibility, loc: nil, comments: [])
super(loc: loc, comments: )
@visibility = visibility
end
|
Instance Attribute Details
#visibility ⇒ Object
Returns the value of attribute visibility.
827
828
829
|
# File 'lib/rbi/model.rb', line 827
def visibility
@visibility
end
|
Instance Method Details
#==(other) ⇒ Object
836
837
838
|
# File 'lib/rbi/model.rb', line 836
def ==(other)
visibility == other.visibility
end
|
#accept_printer(v) ⇒ Object
531
532
533
534
535
536
537
538
|
# File 'lib/rbi/printer.rb', line 531
def accept_printer(v)
previous_node = v.previous_node
v.printn if previous_node && (!previous_node.oneline? || !oneline?)
v.printl("# #{loc}") if loc && v.print_locs
v.visit_all()
v.printl(visibility.to_s)
end
|
#private? ⇒ Boolean
851
852
853
|
# File 'lib/rbi/model.rb', line 851
def private?
visibility == :private
end
|
#protected? ⇒ Boolean
846
847
848
|
# File 'lib/rbi/model.rb', line 846
def protected?
visibility == :protected
end
|
#public? ⇒ Boolean
841
842
843
|
# File 'lib/rbi/model.rb', line 841
def public?
visibility == :public
end
|