Class: Bunch::AbstractNode
- Inherits:
-
Object
- Object
- Bunch::AbstractNode
- Defined in:
- lib/bunch/abstract_node.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #content ⇒ Object (also: #name, #target_extension)
- #write_to_dir(dir) ⇒ Object
- #write_to_file(fn) ⇒ Object
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/bunch/abstract_node.rb', line 3 def @options end |
Instance Method Details
#content ⇒ Object Also known as: name, target_extension
5 6 7 |
# File 'lib/bunch/abstract_node.rb', line 5 def content raise NotImplementedError end |
#write_to_dir(dir) ⇒ Object
11 12 13 |
# File 'lib/bunch/abstract_node.rb', line 11 def write_to_dir(dir) write_to_file(File.join(dir, name)) end |
#write_to_file(fn) ⇒ Object
15 16 17 18 |
# File 'lib/bunch/abstract_node.rb', line 15 def write_to_file(fn) out_file = "#{fn}#{target_extension}" File.open(out_file, 'w') { |f| f.write(content) } end |