Class: CherryTree::SourceCoder
- Inherits:
-
Object
- Object
- CherryTree::SourceCoder
- Defined in:
- lib/ursa/cherry-tree/transformers/source_coder.rb
Instance Attribute Summary collapse
-
#buffer ⇒ Object
Returns the value of attribute buffer.
-
#close_block ⇒ Object
Returns the value of attribute close_block.
-
#indent ⇒ Object
Returns the value of attribute indent.
-
#open_block ⇒ Object
Returns the value of attribute open_block.
-
#tree ⇒ Object
Returns the value of attribute tree.
Instance Method Summary collapse
- #close(&block) ⇒ Object
-
#initialize(tree, options = {}) ⇒ SourceCoder
constructor
A new instance of SourceCoder.
- #open(&block) ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(tree, options = {}) ⇒ SourceCoder
Returns a new instance of SourceCoder.
4 5 6 7 8 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 4 def initialize(tree, = {}) self.tree = tree self.buffer = '' self.indent = [:indent] || 0 end |
Instance Attribute Details
#buffer ⇒ Object
Returns the value of attribute buffer.
2 3 4 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 2 def buffer @buffer end |
#close_block ⇒ Object
Returns the value of attribute close_block.
2 3 4 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 2 def close_block @close_block end |
#indent ⇒ Object
Returns the value of attribute indent.
2 3 4 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 2 def indent @indent end |
#open_block ⇒ Object
Returns the value of attribute open_block.
2 3 4 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 2 def open_block @open_block end |
#tree ⇒ Object
Returns the value of attribute tree.
2 3 4 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 2 def tree @tree end |
Instance Method Details
#close(&block) ⇒ Object
15 16 17 18 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 15 def close(&block) self.close_block = block self end |
#open(&block) ⇒ Object
10 11 12 13 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 10 def open(&block) self.open_block = block self end |
#source ⇒ Object
20 21 22 |
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 20 def source @source ||= get_source end |