Class: Element
- Inherits:
-
Object
- Object
- Element
- Defined in:
- lib/rsyntaxtree/element.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#id ⇒ Object
Returns the value of attribute id.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#level ⇒ Object
Returns the value of attribute level.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#dump ⇒ Object
Debug helper function.
-
#initialize(id = 0, parent = 0, content = NULL, level = 0, type = ETYPE_LEAF) ⇒ Element
constructor
A new instance of Element.
Constructor Details
#initialize(id = 0, parent = 0, content = NULL, level = 0, type = ETYPE_LEAF) ⇒ Element
Returns a new instance of Element.
37 38 39 40 41 42 43 44 45 |
# File 'lib/rsyntaxtree/element.rb', line 37 def initialize(id = 0, parent = 0, content = NULL, level = 0, type = ETYPE_LEAF) @id = id # Unique element id @parent = parent # Parent element id @type = type # Element type @content = content.strip # The actual element content @level = level # Element level in the tree (0=top etc...) @width = 0 # Width of the element in pixels @indent = 0 # Drawing offset end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def content @content end |
#id ⇒ Object
Returns the value of attribute id.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def id @id end |
#indent ⇒ Object
Returns the value of attribute indent.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def indent @indent end |
#level ⇒ Object
Returns the value of attribute level.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def level @level end |
#parent ⇒ Object
Returns the value of attribute parent.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def parent @parent end |
#type ⇒ Object
Returns the value of attribute type.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def type @type end |
#width ⇒ Object
Returns the value of attribute width.
36 37 38 |
# File 'lib/rsyntaxtree/element.rb', line 36 def width @width end |
Instance Method Details
#dump ⇒ Object
Debug helper function
48 49 50 51 52 53 54 55 56 |
# File 'lib/rsyntaxtree/element.rb', line 48 def dump printf( "ID : %d\n", @id ); printf( "Parent : %d\n", @parent ); printf( "Level : %d\n", @level ); printf( "Type : %d\n", @type ); printf( "Width : %d\n", @width ); printf( "Indent : %d\n", @indent ); printf( "Content : %s\n\n", @content ); end |