Sha256: b6a64b5c70ef966dee2db2e0b3220dd3823842d7013ae17ad4c21f0a9b6fcb50

Contents?: true

Size: 842 Bytes

Versions: 12

Compression:

Stored size: 842 Bytes

Contents

module HyperStore
  module ClassMethods
    attr_accessor :__shared_states, :__class_states, :__instance_states

    def state(*args, &block)
      # If we're passing in any arguments then we are calling the macro to define a state
      if args.count > 0
        singleton_class.__state_wrapper.class_state_wrapper
                       .define_state_methods(self, *args, &block)
      # Otherwise we are just accessing it
      else
        @state ||= singleton_class.__state_wrapper.class_state_wrapper.new(self)
      end
    end

    def mutate
      @mutate ||= singleton_class.__state_wrapper.class_mutator_wrapper.new(self)
    end

    def __shared_states
      @__shared_states ||= []
    end

    def __class_states
      @__class_states ||= []
    end

    def __instance_states
      @__instance_states ||= []
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyper-store-0.99.6 lib/hyper-store/class_methods.rb
hyper-store-0.99.5 lib/hyper-store/class_methods.rb
hyper-store-0.99.4 lib/hyper-store/class_methods.rb
hyper-store-0.99.3 lib/hyper-store/class_methods.rb
hyper-store-0.99.2 lib/hyper-store/class_methods.rb
hyper-store-0.99.1 lib/hyper-store/class_methods.rb
hyper-store-0.99.0 lib/hyper-store/class_methods.rb
hyper-store-1.0.0.lap28 lib/hyper-store/class_methods.rb
hyper-store-0.2.3 lib/hyper-store/class_methods.rb
hyper-store-0.2.2 lib/hyper-store/class_methods.rb
hyper-store-0.2.1 lib/hyper-store/class_methods.rb
hyper-store-0.2.0 lib/hyper-store/class_methods.rb