class Itamae::Resource::Base::EvalContext
Attributes
attributes[R]
not_if_command[R]
notifications[R]
only_if_command[R]
subscriptions[R]
verify_commands[R]
Public Class Methods
new(resource)
click to toggle source
# File lib/itamae/resource/base.rb, line 15 def initialize(resource) @resource = resource @attributes = Itamae::Mash.new @notifications = [] @subscriptions = [] @verify_commands = [] end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
Calls superclass method
# File lib/itamae/resource/base.rb, line 28 def method_missing(method, *args, &block) if @resource.class.defined_attributes[method] if args.size == 1 return @attributes[method] = args.first elsif args.size == 0 && block_given? return @attributes[method] = block elsif args.size == 0 return @attributes[method] end end super end
node()
click to toggle source
# File lib/itamae/resource/base.rb, line 58 def node @resource.recipe.runner.node end
not_if(command)
click to toggle source
# File lib/itamae/resource/base.rb, line 54 def not_if(command) @not_if_command = command end
notifies(action, resource_desc, timing = :delay)
click to toggle source
# File lib/itamae/resource/base.rb, line 42 def notifies(action, resource_desc, timing = :delay) @notifications << Notification.create(@resource, action, resource_desc, timing) end
only_if(command)
click to toggle source
# File lib/itamae/resource/base.rb, line 50 def only_if(command) @only_if_command = command end
respond_to_missing?(method, include_private = false)
click to toggle source
Calls superclass method
# File lib/itamae/resource/base.rb, line 24 def respond_to_missing?(method, include_private = false) @resource.class.defined_attributes.has_key?(method) || super end
run_command(*args)
click to toggle source
# File lib/itamae/resource/base.rb, line 62 def run_command(*args) @resource.recipe.runner.backend.run_command(*args) end
subscribes(action, resource_desc, timing = :delay)
click to toggle source
# File lib/itamae/resource/base.rb, line 46 def subscribes(action, resource_desc, timing = :delay) @subscriptions << Subscription.create(@resource, action, resource_desc, timing) end
verify(command)
click to toggle source
Experimental
# File lib/itamae/resource/base.rb, line 67 def verify(command) @verify_commands << command end