Class: Itamae::Resource::LocalRubyBlock

Inherits:
Base
  • Object
show all
Defined in:
lib/itamae/resource/local_ruby_block.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #current_attributes, #notifications, #recipe, #resource_name, #subscriptions, #updated

Instance Method Summary collapse

Methods inherited from Base

#action_nothing, define_attribute, #do_not_run_because_of_not_if?, #do_not_run_because_of_only_if?, inherited, #initialize, #resource_type, #run

Constructor Details

This class inherits a constructor from Itamae::Resource::Base

Instance Method Details

#action_run(options) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/itamae/resource/local_ruby_block.rb', line 7

def action_run(options)
  if attributes[:cwd]
    Dir.chdir(attributes[:cwd]) do
      attributes.block.call
    end
  else
    attributes.block.call
  end
end