Class: OrigenVerilog::Preprocessor::Writer
- Inherits:
-
OrigenVerilog::Processor
- Object
- OrigenVerilog::Processor
- OrigenVerilog::Preprocessor::Writer
- Defined in:
- lib/origen_verilog/preprocessor/writer.rb
Instance Method Summary collapse
- #on_text_block(node) ⇒ Object (also: #on_comment)
-
#run(file, ast) ⇒ Object
Write the given ast to the given file.
-
#to_s(ast) ⇒ Object
Write the given ast to a string and returns it.
Methods inherited from OrigenVerilog::Processor
#handler_missing, #inline, #process, #process_all
Instance Method Details
#on_text_block(node) ⇒ Object Also known as: on_comment
19 20 21 22 23 24 25 |
# File 'lib/origen_verilog/preprocessor/writer.rb', line 19 def on_text_block(node) if f.is_a?(String) f << node.to_a[0] else f.write(node.to_a[0]) end end |
#run(file, ast) ⇒ Object
Write the given ast to the given file
5 6 7 8 9 10 |
# File 'lib/origen_verilog/preprocessor/writer.rb', line 5 def run(file, ast) File.open(file, 'w') do |file| @file = file process(ast) end end |
#to_s(ast) ⇒ Object
Write the given ast to a string and returns it
13 14 15 16 17 |
# File 'lib/origen_verilog/preprocessor/writer.rb', line 13 def to_s(ast) @file = '' process(ast) @file end |