Class: Tables
- Inherits:
-
Object
- Object
- Tables
- Defined in:
- lib/ymldot.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#entity_dict ⇒ Object
Returns the value of attribute entity_dict.
-
#label ⇒ Object
Returns the value of attribute label.
-
#table_node ⇒ Object
Returns the value of attribute table_node.
Instance Method Summary collapse
- #add_entity(table) ⇒ Object
-
#initialize(table_node, label = nil, category = false) ⇒ Tables
constructor
A new instance of Tables.
- #to_csv ⇒ Object
- #to_dot ⇒ Object
Constructor Details
#initialize(table_node, label = nil, category = false) ⇒ Tables
Returns a new instance of Tables.
43 44 45 46 47 48 49 50 |
# File 'lib/ymldot.rb', line 43 def initialize(table_node, label=nil, category=false) @label = label @category = category @table_node = table_node @entity_dict = {} @natural_order_entity = [] table_node.each {|t| eval_entity(t) } end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
51 52 53 |
# File 'lib/ymldot.rb', line 51 def category @category end |
#entity_dict ⇒ Object
Returns the value of attribute entity_dict.
51 52 53 |
# File 'lib/ymldot.rb', line 51 def entity_dict @entity_dict end |
#label ⇒ Object
Returns the value of attribute label.
51 52 53 |
# File 'lib/ymldot.rb', line 51 def label @label end |
#table_node ⇒ Object
Returns the value of attribute table_node.
51 52 53 |
# File 'lib/ymldot.rb', line 51 def table_node @table_node end |
Instance Method Details
#add_entity(table) ⇒ Object
70 71 72 |
# File 'lib/ymldot.rb', line 70 def add_entity(table) eval_entity(table) end |
#to_csv ⇒ Object
64 65 66 67 68 |
# File 'lib/ymldot.rb', line 64 def to_csv res = "" @natural_order_entity.each{|e| res << e.to_csv << "\n"} res end |
#to_dot ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ymldot.rb', line 53 def to_dot res = "" s = @natural_order_entity if @category res << "label=#{@label}\n" if @label res << "style=invis\n" unless @label end s.each{|e| res << e.to_dot << "\n"} res end |