class AASM::InstanceBase
def events(options={}, *args)
def events(options={}, *args) state = options[:state] || current_state events = @instance.class.aasm(@name).events.select {|e| e.transitions_from_state?(state) } options[:reject] = Array(options[:reject]) events.reject! { |e| options[:reject].include?(e.name) } if options.has_key?(:permitted) # filters the results of events_for_current_state so that only those that # are really currently possible (given transition guards) are shown. if options[:permitted] events.select! { |e| @instance.send("may_#{e.name}?", *args) } else events.select! { |e| !@instance.send("may_#{e.name}?", *args) } end end events end