Module: Less::Node::Entity
- Defined in:
- lib/less/engine/nodes/entity.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #initialize(value, parent = nil) ⇒ Object
- #inspect ⇒ Object
-
#path(node = self) ⇒ Object
Returns the path from any given node, to the root.
- #root ⇒ Object
- #to_css ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
26 27 28 |
# File 'lib/less/engine/nodes/entity.rb', line 26 def parent @parent end |
Instance Method Details
#initialize(value, parent = nil) ⇒ Object
28 29 30 31 |
# File 'lib/less/engine/nodes/entity.rb', line 28 def initialize value, parent = nil super value @parent = parent end |
#inspect ⇒ Object
51 |
# File 'lib/less/engine/nodes/entity.rb', line 51 def inspect; to_s end |
#path(node = self) ⇒ Object
Returns the path from any given node, to the root
ex: ['color', 'p', '#header', 'body', '*']
38 39 40 41 42 43 44 45 |
# File 'lib/less/engine/nodes/entity.rb', line 38 def path node = self path = [] while node do path << node node = node.parent end path end |
#root ⇒ Object
47 48 49 |
# File 'lib/less/engine/nodes/entity.rb', line 47 def root path.last end |
#to_css ⇒ Object
52 |
# File 'lib/less/engine/nodes/entity.rb', line 52 def to_css; to_s end |
#to_s ⇒ Object
53 |
# File 'lib/less/engine/nodes/entity.rb', line 53 def to_s; super end |