Class: Snapbot::Diagram::DotGenerator
- Inherits:
-
Object
- Object
- Snapbot::Diagram::DotGenerator
- Defined in:
- lib/snapbot/diagram/dot_generator.rb
Overview
Get a visual handle on what small constellations of objects we’re creating in specs
Instance Method Summary collapse
- #dot ⇒ Object
-
#initialize(label: "g", attrs: false, ignore_lets: %i[], rspec: false) ⇒ DotGenerator
constructor
A new instance of DotGenerator.
Constructor Details
#initialize(label: "g", attrs: false, ignore_lets: %i[], rspec: false) ⇒ DotGenerator
Returns a new instance of DotGenerator.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/snapbot/diagram/dot_generator.rb', line 15 def initialize(label: "g", attrs: false, ignore_lets: i[], rspec: false) @label = label = { attrs: attrs } @ignore_lets = ignore_lets @lets_by_value = if rspec example = binding.of_caller(1).eval("self") collect_lets(example) else {} end end |
Instance Method Details
#dot ⇒ Object
28 29 30 31 |
# File 'lib/snapbot/diagram/dot_generator.rb', line 28 def dot renderer = ERB.new(template, trim_mode: "-") renderer.result(self.binding) end |