Sha256: 57f81be83bb71d97b2fca03be7002b6aa3c669ee17426edd0058ee0b0980ccb3
Contents?: true
Size: 1.38 KB
Versions: 30
Compression:
Stored size: 1.38 KB
Contents
class Card module MachineInput module ClassMethods attr_accessor :machines_wql def machine_input_for args @machines_wql = args end def machine_input &block define_method :machine_input, block end end def self.included host_class host_class.extend( ClassMethods ) host_class.machines_wql = {} host_class.machine_input do format._render_raw end host_class.event "after_machine_input_updated_#{host_class.name.gsub(':','_')}".to_sym, :after=>:extend, :on => :save do machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end host_class.event "before_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:approve, :on => :delete do @involved_machines = Card.search( {:right_plus => [{:codename => "machine_input"}, {:link_to => name}]}.merge(host_class.machines_wql) ) end host_class.event "after_machine_input_deleted_#{host_class.name.gsub(':','_')}".to_sym, :after=>:store_subcards, :on => :delete do @involved_machines.each do |item| item.reset_machine_output! if item.kind_of? Machine end end end end end
Version data entries
30 entries across 30 versions & 2 rubygems