Class: CLI::Mastermind::Loader::PlanfileLoader::DSL
- Inherits:
-
Object
- Object
- CLI::Mastermind::Loader::PlanfileLoader::DSL
- Defined in:
- lib/cli/mastermind/loader/planfile_loader.rb
Instance Attribute Summary collapse
-
#plans ⇒ Object
readonly
Returns the value of attribute plans.
Instance Method Summary collapse
- #description(text) ⇒ Object (also: #desc)
-
#initialize(filename = nil, &block) ⇒ DSL
constructor
A new instance of DSL.
- #plan(name, &block) ⇒ Object (also: #task)
- #plot(name, &block) ⇒ Object (also: #namespace)
Constructor Details
#initialize(filename = nil, &block) ⇒ DSL
Returns a new instance of DSL.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cli/mastermind/loader/planfile_loader.rb', line 15 def initialize(filename=nil, &block) @plans = [] if block_given? instance_eval(&block) elsif File.exists? filename instance_eval(File.read(filename), filename, 0) else raise 'Must provide valid path to a planfile or a block', Error end end |
Instance Attribute Details
#plans ⇒ Object (readonly)
Returns the value of attribute plans.
13 14 15 |
# File 'lib/cli/mastermind/loader/planfile_loader.rb', line 13 def plans @plans end |
Instance Method Details
#description(text) ⇒ Object Also known as: desc
35 36 37 |
# File 'lib/cli/mastermind/loader/planfile_loader.rb', line 35 def description(text) @description = text end |