Class: Eatr::DotGenerator
- Inherits:
-
Object
- Object
- Eatr::DotGenerator
- Defined in:
- lib/eatr/dot_generator.rb
Constant Summary collapse
- DEFAULT_TEMPLATE_PATH =
"#{File.dirname(__FILE__)}/dot_template.dot"
Instance Attribute Summary collapse
-
#tables ⇒ Object
readonly
Returns the value of attribute tables.
Instance Method Summary collapse
-
#initialize(schema_paths, template_path: DEFAULT_TEMPLATE_PATH) ⇒ DotGenerator
constructor
A new instance of DotGenerator.
- #to_dot ⇒ Object
Constructor Details
#initialize(schema_paths, template_path: DEFAULT_TEMPLATE_PATH) ⇒ DotGenerator
Returns a new instance of DotGenerator.
7 8 9 10 |
# File 'lib/eatr/dot_generator.rb', line 7 def initialize(schema_paths, template_path: DEFAULT_TEMPLATE_PATH) @tables = Array[schema_paths].flatten.map { |s| Schema.new(YAML.load(File.read(s))) } @template_path = template_path end |
Instance Attribute Details
#tables ⇒ Object (readonly)
Returns the value of attribute tables.
3 4 5 |
# File 'lib/eatr/dot_generator.rb', line 3 def tables @tables end |
Instance Method Details
#to_dot ⇒ Object
12 13 14 |
# File 'lib/eatr/dot_generator.rb', line 12 def to_dot ERB.new(File.read(@template_path), nil, '-').result(binding) end |