Sha256: 3f318eb2f4a55cb19eb7e54ced5f3bf8c57c364d2be41a0614c0216f6a4ff95d
Contents?: true
Size: 769 Bytes
Versions: 3
Compression:
Stored size: 769 Bytes
Contents
require 'active_support/core_ext/class/attribute' module Memento::Action class Base def initialize(state) @state = state end attr_reader :state class_attribute :action_types, :instance_reader => false, :instance_writer => false self.action_types = [] def record @state.record end def record_data @state.record_data end def fetch? true end def self.inherited(child) self.action_types << child.name.demodulize.underscore 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
memento-0.3.7 | lib/memento/action.rb |
memento-0.3.6 | lib/memento/action.rb |
memento-0.3.5 | lib/memento/action.rb |