Class: Splice::ExecutionContext
- Inherits:
-
Object
- Object
- Splice::ExecutionContext
- Defined in:
- lib/execution_context.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(search_tmp = false) ⇒ ExecutionContext
constructor
A new instance of ExecutionContext.
- #parse(some_file) ⇒ Object
Constructor Details
#initialize(search_tmp = false) ⇒ ExecutionContext
Returns a new instance of ExecutionContext.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/execution_context.rb', line 7 def initialize(search_tmp = false) @settings = Hash.new SEARCH_PATHS.each do |path| is_not_tmp = true unless path == "/tmp/dna.yml" and search_tmp == false if File.exists?(path) and is_not_tmp path_settings = YAML.load_file(path) path_settings.each_pair {|key,value| @settings[key] ||= value} end end end |
Instance Attribute Details
#settings ⇒ Object
Returns the value of attribute settings.
5 6 7 |
# File 'lib/execution_context.rb', line 5 def settings @settings end |
Instance Method Details
#parse(some_file) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/execution_context.rb', line 22 def parse(some_file) e = ERB.new File.read(some_file) result = e.result(binding) new_path = some_file.split(".") new_path.delete_at(new_path.count - 1) #Delete the erb extension new_path = new_path.join(".") File.open(new_path,'w') {|f| f.write(result) } result end |