Class: Ymldot
- Inherits:
-
Object
- Object
- Ymldot
- Defined in:
- lib/ymldot.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
Instance Method Summary collapse
-
#initialize(filepath) ⇒ Ymldot
constructor
A new instance of Ymldot.
- #to_csv ⇒ Object
- #to_dot ⇒ Object
Constructor Details
#initialize(filepath) ⇒ Ymldot
Returns a new instance of Ymldot.
90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ymldot.rb', line 90 def initialize(filepath) open(filepath) do |f| str = f.read @node = YAML.load(str) end @file_name = $1 if filepath[/(\w+).yml\z/] @entity_dict = {} @category = [] @one_relations = [] @many_relations = [] eval_yml end |
Instance Attribute Details
#file_name ⇒ Object
Returns the value of attribute file_name.
88 89 90 |
# File 'lib/ymldot.rb', line 88 def file_name @file_name end |
Instance Method Details
#to_csv ⇒ Object
114 115 116 117 118 119 120 |
# File 'lib/ymldot.rb', line 114 def to_csv csv = "" @category.each do |e| csv << e.to_csv end csv end |
#to_dot ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/ymldot.rb', line 103 def to_dot code = "" code += <<"EOS" digraph #{@file_name} { #{add_2_tab(config_to_dot)} #{add_2_tab(entity_to_dot)} #{add_2_tab(relations_to_dot)} } EOS end |