module HyperStore::ClassMethods

Attributes

__class_states[RW]
__instance_states[RW]
__shared_states[RW]

Public Instance Methods

mutate() click to toggle source
# File lib/hyper-store/class_methods.rb, line 16
def mutate
  @mutate ||= singleton_class.__state_wrapper.class_mutator_wrapper.new(self)
end
state(*args, &block) click to toggle source
# File lib/hyper-store/class_methods.rb, line 5
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