Class: Raudi::Source::Base
- Inherits:
-
Object
- Object
- Raudi::Source::Base
- Includes:
- Action, BitOperations, Block, Function, Variable
- Defined in:
- lib/raudi/source.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#source_text ⇒ Object
Returns the value of attribute source_text.
Instance Method Summary collapse
- #code_line(line, params = {}) ⇒ Object
- #code_lines(lines) ⇒ Object
- #new_line ⇒ Object
- #reset_source_text ⇒ Object
Methods included from Variable
Methods included from Function
#function_arguments, #function_block, #generate_function_header, #generate_result
Methods included from Block
#block_in, #block_out, #code_block, #indent_count, #indent_count=, #indent_line, #reset_indent_count
Methods included from BitOperations
#clear_register, #join_bits, #write_register
Methods included from Action
Instance Attribute Details
#source_text ⇒ Object
Returns the value of attribute source_text.
19 20 21 |
# File 'lib/raudi/source.rb', line 19 def source_text @source_text end |
Instance Method Details
#code_line(line, params = {}) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/raudi/source.rb', line 21 def code_line(line, params = {}) source_text << indent_line source_text << line source_text << ';' unless params[:skip_semicolon] source_text << new_line unless params[:same_line] end |
#code_lines(lines) ⇒ Object
28 29 30 |
# File 'lib/raudi/source.rb', line 28 def code_lines(lines) lines.each_line{ |line| code_line(line, skip_semicolon: true, same_line: true) } end |
#new_line ⇒ Object
32 33 34 |
# File 'lib/raudi/source.rb', line 32 def new_line "\r\n" end |
#reset_source_text ⇒ Object
36 37 38 |
# File 'lib/raudi/source.rb', line 36 def reset_source_text self.source_text = "" end |