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
# File lib/base_object.rb, line 205 def action_urls actions.collect { |a| a.last } end
# 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
# File lib/base_object.rb, line 184 def add_action_link!(id, link) m = { :type => :action_link, :method_name => "#{link['rel'].sanitize}!", :id => id, :href => link['href'], :rel => link['rel'].sanitize, :method => link['method'].sanitize } @objects << m @actions << [m[:rel], m[:href]] @action_urls << m[:href] end
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
Generated with the Darkfish Rdoc Generator 2.