DeltaCloud::ActionObject

Public Class Methods

new(opts={}, &block) click to toggle source
# File lib/base_object.rb, line 172
def initialize(opts={}, &block)
  super(opts)
  @action_urls = opts[:action_urls] || []
  @actions = []
end

Public Instance Methods

action_trigger(action) click to toggle source

This trigger is called right after action. This method does nothing inside ActionObject but it can be redifined and used in meta-programming

# File lib/base_object.rb, line 181
def action_trigger(action)
end
action_urls() click to toggle source
# File lib/base_object.rb, line 205
def action_urls
  actions.collect { |a| a.last }
end
actions() click to toggle source
# File lib/base_object.rb, line 198
def actions
  @objects.inject([]) do |result, item|
    result << [item[:rel], item[:href]] if item[:type].eql?(:action_link)
    result
  end
end
base_method_handler(m, args=[]) click to toggle source
Alias for: method_handler
method_handler(m, args=[]) click to toggle source

First call BaseObject method handler, then, if not method found try ActionObject handler

# File lib/base_object.rb, line 213
def method_handler(m, args=[])
  begin
    base_method_handler(m, args)
  rescue NoHandlerForMethod
    case m[:type]
      when :action_link then do_action(m, args)
      else raise NoHandlerForMethod
    end
  end
end
Also aliased as: base_method_handler

[Validate]

Generated with the Darkfish Rdoc Generator 2.