Class: Superhosting::ScriptExecutor::Base
- Inherits:
-
Object
- Object
- Superhosting::ScriptExecutor::Base
- Includes:
- Helpers
- Defined in:
- lib/superhosting/script_executor/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#config ⇒ Object
Returns the value of attribute config.
-
#lib ⇒ Object
Returns the value of attribute lib.
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
- #execute(script) ⇒ Object
-
#initialize(model:, lib:, config:, **kwargs) ⇒ Base
constructor
A new instance of Base.
Methods included from Helpers
#create_conf, #erb, #instance_variables_to_hash, #remove_line_from_file, #write_if_not_exist
Constructor Details
#initialize(model:, lib:, config:, **kwargs) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/superhosting/script_executor/base.rb', line 9 def initialize(model:, lib:, config:, **kwargs) kwargs.each do |k, v| instance_variable_set("@#{k}", v) self.class.class_eval("attr_accessor :#{k}") end self.commands = [] self.model = model self.lib = lib self.config = config end |
Instance Attribute Details
#commands ⇒ Object
Returns the value of attribute commands.
6 7 8 |
# File 'lib/superhosting/script_executor/base.rb', line 6 def commands @commands end |
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/superhosting/script_executor/base.rb', line 7 def config @config end |
#lib ⇒ Object
Returns the value of attribute lib.
7 8 9 |
# File 'lib/superhosting/script_executor/base.rb', line 7 def lib @lib end |
#model ⇒ Object
Returns the value of attribute model.
7 8 9 |
# File 'lib/superhosting/script_executor/base.rb', line 7 def model @model end |
Instance Method Details
#execute(script) ⇒ Object
21 22 23 |
# File 'lib/superhosting/script_executor/base.rb', line 21 def execute(script) self.instance_eval(script) end |