Class: Raudi::Source::Base

Inherits:
Object
  • Object
show all
Includes:
Action, BitOperations, Block, Function, Variable
Defined in:
lib/raudi/source.rb

Direct Known Subclasses

Controller

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Variable

#generate_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

#insert_action

Instance Attribute Details

#source_textObject

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_lineObject



32
33
34
# File 'lib/raudi/source.rb', line 32

def new_line
  "\r\n"
end

#reset_source_textObject



36
37
38
# File 'lib/raudi/source.rb', line 36

def reset_source_text
  self.source_text = ""
end