Sha256: 61993e95e28f810fbeb8513240b3fb386757e647eb3585d00d2d6517e96f1549
Contents?: true
Size: 767 Bytes
Versions: 5
Compression:
Stored size: 767 Bytes
Contents
module Memento::Action class Base def initialize(state) @state = state end attr_reader :state def record @state.record end def record_data @state.record_data end def fetch? true end def self.inherited(child) action_type = child.name.demodulize.underscore write_inheritable_attribute(:action_types, action_types << action_type) end def self.action_types read_inheritable_attribute(:action_types) || [] end private def new_object object = @state.record_type.constantize.new yield(object) if block_given? object end end end Dir["#{File.dirname(__FILE__)}/action/*.rb"].each { |action| require action }
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
memento-0.3.4 | lib/memento/action.rb |
memento-0.3.3 | lib/memento/action.rb |
memento-0.3.2 | lib/memento/action.rb |
memento-0.3.1 | lib/memento/action.rb |
memento-0.3.0 | lib/memento/action.rb |