Class: Toolchain
- Inherits:
-
Object
- Object
- Toolchain
- Defined in:
- lib/cxxproject/toolchain/toolchain.rb
Instance Attribute Summary collapse
-
#toolchain ⇒ Object
readonly
Returns the value of attribute toolchain.
Instance Method Summary collapse
-
#initialize(toolchain_file) ⇒ Toolchain
constructor
A new instance of Toolchain.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(toolchain_file) ⇒ Toolchain
Returns a new instance of Toolchain.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cxxproject/toolchain/toolchain.rb', line 7 def initialize(toolchain_file) @toolchain = YAML::load(File.open(toolchain_file)) if @toolchain.base @based_on = @toolchain.base else @based_on = "base" end basechain = YAML::load(File.open(File.join(File.dirname(__FILE__),"#{@based_on}.json"))) @toolchain = basechain.recursive_merge(@toolchain) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/cxxproject/toolchain/toolchain.rb', line 18 def method_missing(m, *args, &block) if @toolchain[m.to_s] self.class.send(:define_method, m) { @toolchain[m.to_s] } @toolchain[m.to_s] else return super end end |
Instance Attribute Details
#toolchain ⇒ Object (readonly)
Returns the value of attribute toolchain.
5 6 7 |
# File 'lib/cxxproject/toolchain/toolchain.rb', line 5 def toolchain @toolchain end |