Sha256: 6bfd0f0f99d326b3734eb62b7a8bb51b85b8f3f95dcc3e2fd3bb23be972adbc4

Contents?: true

Size: 475 Bytes

Versions: 8

Compression:

Stored size: 475 Bytes

Contents

module StateMachines::Page
  def self.included(base)
    base.extend ClassMethods
    
    base.class_eval do
      attr_accessor :current_user
      
      const_set 'STATES', [:active]
      const_set 'EVENTS', []
      
      after_initialize :set_initial_state
      
      state_machine :state, initial: :active do
      end
      
      private
      
      def set_initial_state
        self.state ||= :active
      end
    end
  end
  
  module ClassMethods
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
voluntary-0.7.1 app/models/state_machines/page.rb
voluntary-0.7.0 app/models/state_machines/page.rb
voluntary-0.6.0 app/models/state_machines/page.rb
voluntary-0.5.2 app/models/state_machines/page.rb
voluntary-0.5.1 app/models/state_machines/page.rb
voluntary-0.5.0 app/models/state_machines/page.rb
voluntary-0.4.0 app/models/state_machines/page.rb
voluntary-0.3.0 app/models/state_machines/page.rb