Sha256: 65e0d6d9aa78f496e1ad33821a26831881e2fcd315400e583f795727e240aa96

Contents?: true

Size: 991 Bytes

Versions: 9

Compression:

Stored size: 991 Bytes

Contents

module Hyperstack
  module Internal
    module Store
      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
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hyper-store-1.0.alpha1.8 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.7 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.6 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.5 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.4 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.3 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.2 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1.1 lib/hyperstack/internal/store/class_methods.rb
hyper-store-1.0.alpha1 lib/hyperstack/internal/store/class_methods.rb