Class: Flexibee::Node
- Inherits:
-
Object
- Object
- Flexibee::Node
- Defined in:
- lib/flexibee/node.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
}.
-
#description ⇒ Object
}.
-
#id ⇒ Object
}.
-
#keywords ⇒ Object
}.
-
#level ⇒ Object
}.
-
#name ⇒ Object
}.
-
#order ⇒ Object
}.
-
#parent_id ⇒ Object
}.
-
#parent_ref ⇒ Object
}.
-
#route ⇒ Object
}.
-
#short_description ⇒ Object
}.
-
#tree ⇒ Object
}.
-
#tree_ref ⇒ Object
}.
-
#updated_at ⇒ Object
}.
Instance Method Summary collapse
-
#descendants ⇒ Object
all children of the node.
-
#initialize(response, tree) ⇒ Node
constructor
A new instance of Node.
-
#parent ⇒ Object
parent of the node.
Constructor Details
#initialize(response, tree) ⇒ Node
Returns a new instance of Node.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/flexibee/node.rb', line 34 def initialize(response, tree) @id = response['id'].to_i @updated_at = response['lastUpdate'] @code = response['kod'] @name = response['nazev'] @level = response['hladina'].to_i @order = response['poradi'].to_i @route = response['cesta'] @short_description = response['kratkyPopis'] @keywords = response['klicSlova'] @description = response['popis'] @tree_ref = response['strom@ref'] @parent_id = response['otec'].to_i @parent_ref = response['otec@ref'] @tree = tree end |
Instance Attribute Details
#code ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def code @code end |
#description ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def description @description end |
#id ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def id @id end |
#keywords ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def keywords @keywords end |
#level ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def level @level end |
#name ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def name @name end |
#order ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def order @order end |
#parent_id ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def parent_id @parent_id end |
#parent_ref ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def parent_ref @parent_ref end |
#route ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def route @route end |
#short_description ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def short_description @short_description end |
#tree ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def tree @tree end |
#tree_ref ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def tree_ref @tree_ref end |
#updated_at ⇒ Object
}
31 32 33 |
# File 'lib/flexibee/node.rb', line 31 def updated_at @updated_at end |
Instance Method Details
#descendants ⇒ Object
all children of the node
54 55 56 |
# File 'lib/flexibee/node.rb', line 54 def descendants tree.children_of(id) end |
#parent ⇒ Object
parent of the node
61 62 63 |
# File 'lib/flexibee/node.rb', line 61 def parent tree.parent_for(parent_id).first end |