Module: Yerba::Node
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#selector ⇒ Object
readonly
Returns the value of attribute selector.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/yerba/node.rb', line 5 def key @key end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/yerba/node.rb', line 5 def location @location end |
#selector ⇒ Object (readonly)
Returns the value of attribute selector.
5 6 7 |
# File 'lib/yerba/node.rb', line 5 def selector @selector end |
Class Method Details
.included(base) ⇒ Object
43 44 45 |
# File 'lib/yerba/node.rb', line 43 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#connected? ⇒ Boolean
19 20 21 |
# File 'lib/yerba/node.rb', line 19 def connected? !@document.nil? || !@file_path.nil? end |
#document ⇒ Object
15 16 17 |
# File 'lib/yerba/node.rb', line 15 def document @document ||= @file_path ? Yerba::Document.cache[@file_path] : nil end |
#file_path ⇒ Object
7 8 9 |
# File 'lib/yerba/node.rb', line 7 def file_path @file_path || @document&.path end |
#line ⇒ Object
11 12 13 |
# File 'lib/yerba/node.rb', line 11 def line @line || @location&.start_line end |