Class: CherryTree::SourceCoder

Inherits:
Object
  • Object
show all
Defined in:
lib/ursa/cherry-tree/transformers/source_coder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  self.tree = tree
  self.buffer = ''
  self.indent = options[:indent] || 0
end

Instance Attribute Details

#bufferObject

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_blockObject

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

#indentObject

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_blockObject

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

#treeObject

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

#sourceObject



20
21
22
# File 'lib/ursa/cherry-tree/transformers/source_coder.rb', line 20

def source
  @source ||= get_source
end