Class: KiskoSuits::Compiler
- Inherits:
-
Object
- Object
- KiskoSuits::Compiler
- Defined in:
- lib/kisko-suits/compiler.rb
Instance Attribute Summary collapse
-
#included_filenames ⇒ Object
readonly
Returns the value of attribute included_filenames.
-
#output_filename ⇒ Object
readonly
Returns the value of attribute output_filename.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Compiler
constructor
A new instance of Compiler.
- #render ⇒ Object
Constructor Details
#initialize(path) ⇒ Compiler
Returns a new instance of Compiler.
7 8 9 10 11 12 13 |
# File 'lib/kisko-suits/compiler.rb', line 7 def initialize(path) @path = path @output_filename = nil @included_filenames = Set.new @variables = {} end |
Instance Attribute Details
#included_filenames ⇒ Object (readonly)
Returns the value of attribute included_filenames.
5 6 7 |
# File 'lib/kisko-suits/compiler.rb', line 5 def included_filenames @included_filenames end |
#output_filename ⇒ Object (readonly)
Returns the value of attribute output_filename.
5 6 7 |
# File 'lib/kisko-suits/compiler.rb', line 5 def output_filename @output_filename end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/kisko-suits/compiler.rb', line 5 def path @path end |
Instance Method Details
#render ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kisko-suits/compiler.rb', line 15 def render @included_filenames.clear @variables.clear abort "Suits file '#{path}' not found" unless File.exists?(path) open_output_file do |output| File.foreach(path).each do |line| output.write(process_line(File.dirname(path), line)) end end end |