Class: Dappgen::DapperConfig
- Inherits:
-
Object
- Object
- Dappgen::DapperConfig
- Defined in:
- lib/dappgen/dapper_config.rb
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#script ⇒ Object
readonly
Returns the value of attribute script.
Class Method Summary collapse
Instance Method Summary collapse
- #copy_base!(source = nil) ⇒ Object
- #generate(name, with:) ⇒ Object
- #in_directory(name) ⇒ Object
-
#initialize(script, filename) ⇒ DapperConfig
constructor
A new instance of DapperConfig.
- #remove(name) ⇒ Object
- #requires(argument_name) ⇒ Object
Constructor Details
#initialize(script, filename) ⇒ DapperConfig
Returns a new instance of DapperConfig.
11 12 13 14 15 |
# File 'lib/dappgen/dapper_config.rb', line 11 def initialize(script, filename) @arguments = {} @script = [] instance_eval script, filename end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
9 10 11 |
# File 'lib/dappgen/dapper_config.rb', line 9 def arguments @arguments end |
#script ⇒ Object (readonly)
Returns the value of attribute script.
9 10 11 |
# File 'lib/dappgen/dapper_config.rb', line 9 def script @script end |
Class Method Details
.execute(filename) ⇒ Object
5 6 7 |
# File 'lib/dappgen/dapper_config.rb', line 5 def self.execute(filename) DapperConfig.new(File.read(filename), filename) end |
Instance Method Details
#copy_base!(source = nil) ⇒ Object
36 37 38 |
# File 'lib/dappgen/dapper_config.rb', line 36 def copy_base!(source = nil) @script << { copy_base: source } end |
#generate(name, with:) ⇒ Object
28 29 30 |
# File 'lib/dappgen/dapper_config.rb', line 28 def generate(name, with:) @script << { generate: name, with: with } end |
#in_directory(name) ⇒ Object
32 33 34 |
# File 'lib/dappgen/dapper_config.rb', line 32 def in_directory(name) @script << { setdir: name } end |
#remove(name) ⇒ Object
24 25 26 |
# File 'lib/dappgen/dapper_config.rb', line 24 def remove(name) @script << { remove: name } end |
#requires(argument_name) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/dappgen/dapper_config.rb', line 17 def requires(argument_name) @arguments[argument_name] = { required: true, multiple: false } end |