Class: NetConfGen::Block
- Inherits:
-
Object
- Object
- NetConfGen::Block
- Defined in:
- lib/netconfgen/netconfgen.rb
Instance Attribute Summary collapse
-
#blockengine ⇒ Object
Returns the value of attribute blockengine.
-
#code ⇒ Object
Returns the value of attribute code.
Instance Method Summary collapse
-
#initialize(name) ⇒ Block
constructor
A new instance of Block.
- #render ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Block
Returns a new instance of Block.
16 17 18 |
# File 'lib/netconfgen/netconfgen.rb', line 16 def initialize(name) @name = name end |
Instance Attribute Details
#blockengine ⇒ Object
Returns the value of attribute blockengine.
14 15 16 |
# File 'lib/netconfgen/netconfgen.rb', line 14 def blockengine @blockengine end |
#code ⇒ Object
Returns the value of attribute code.
14 15 16 |
# File 'lib/netconfgen/netconfgen.rb', line 14 def code @code end |
Instance Method Details
#render ⇒ Object
20 21 22 23 24 |
# File 'lib/netconfgen/netconfgen.rb', line 20 def render t = ERB.new(@code) str = t.result(@blockengine.context.instance_eval { binding }) return str end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/netconfgen/netconfgen.rb', line 26 def to_s self.render end |