Class: Dappgen::Script
- Inherits:
-
Object
- Object
- Dappgen::Script
- Defined in:
- lib/dappgen/script.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #built_script ⇒ Object
-
#initialize(dapper_config, thing, opts) ⇒ Script
constructor
A new instance of Script.
Constructor Details
#initialize(dapper_config, thing, opts) ⇒ Script
Returns a new instance of Script.
7 8 9 10 11 |
# File 'lib/dappgen/script.rb', line 7 def initialize(dapper_config, thing, opts) @dapper_config = dapper_config @thing = thing @opts = opts end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
5 6 7 |
# File 'lib/dappgen/script.rb', line 5 def opts @opts end |
Instance Method Details
#built_script ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/dappgen/script.rb', line 13 def built_script result = [] @dapper_config.script.each do |statements| result_statement = {} statements.each do |key, value| if value.is_a? String value = value.gsub(/<([^>]+)>/) do |match| opts[match[1..-2].to_sym] end end result_statement[key] = value end result << result_statement end [ { set_thing: @thing, opts: @opts }, *result, { cleanup: true } ] end |