Class: CooCoo::GenerationScript
- Defined in:
- lib/coo-coo/generation_script.rb
Defined Under Namespace
Classes: EvalBinding
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #call(argv, *args) ⇒ Object
-
#initialize(path, log) ⇒ GenerationScript
constructor
A new instance of GenerationScript.
- #load(path) ⇒ Object
- #parse_args(argv) ⇒ Object
Constructor Details
#initialize(path, log) ⇒ GenerationScript
Returns a new instance of GenerationScript.
16 17 18 19 20 |
# File 'lib/coo-coo/generation_script.rb', line 16 def initialize(path, log) @path = path @log = log load(path) end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
14 15 16 |
# File 'lib/coo-coo/generation_script.rb', line 14 def opts @opts end |
Instance Method Details
#call(argv, *args) ⇒ Object
33 34 35 36 |
# File 'lib/coo-coo/generation_script.rb', line 33 def call(argv, *args) argv = parse_args(argv) [ argv, @generator.call(*args) ] end |
#load(path) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/coo-coo/generation_script.rb', line 22 def load(path) env = EvalBinding.new(@log) @generator, @opts = eval(File.read(path), env.get_binding, path) @path = path self end |
#parse_args(argv) ⇒ Object
29 30 31 |
# File 'lib/coo-coo/generation_script.rb', line 29 def parse_args(argv) @opts.parse!(argv) end |