Class: Mikoshi::Plan::Base
- Inherits:
-
Object
- Object
- Mikoshi::Plan::Base
- Defined in:
- lib/mikoshi/plan.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Instance Method Summary collapse
-
#initialize(yaml_path: nil, client: nil) ⇒ Base
constructor
A new instance of Base.
- #invoke_hooks(hooks) ⇒ Object
Constructor Details
#initialize(yaml_path: nil, client: nil) ⇒ Base
Returns a new instance of Base.
14 15 16 17 18 19 20 |
# File 'lib/mikoshi/plan.rb', line 14 def initialize(yaml_path: nil, client: nil) raise ArgumentError, 'Yaml file path is required.' if yaml_path.nil? raise ArgumentError, 'client is required.' if client.nil? @data = YAML.safe_load(ERB.new(File.new(yaml_path).read).result).deep_symbolize_keys @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
12 13 14 |
# File 'lib/mikoshi/plan.rb', line 12 def client @client end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
12 13 14 |
# File 'lib/mikoshi/plan.rb', line 12 def data @data end |
Instance Method Details
#invoke_hooks(hooks) ⇒ Object
22 23 24 25 26 |
# File 'lib/mikoshi/plan.rb', line 22 def invoke_hooks(hooks) hooks.each do |hook| raise(HookExecutionError, hook) unless system(hook) end end |