Module: Less::Node::Entity

Included in:
Anonymous, Element, Function, Keyword, Literal, Mixin::Call, Property, Selector
Defined in:
lib/less/engine/nodes/entity.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#parentObject

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

#inspectObject



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

#rootObject



47
48
49
# File 'lib/less/engine/nodes/entity.rb', line 47

def root
  path.last
end

#to_cssObject



52
# File 'lib/less/engine/nodes/entity.rb', line 52

def to_css;   to_s  end

#to_sObject



53
# File 'lib/less/engine/nodes/entity.rb', line 53

def to_s;     super end