Module: HyperStore::ClassMethods

Defined in:
lib/hyper-store/class_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__class_statesObject

Returns the value of attribute __class_states.



3
4
5
# File 'lib/hyper-store/class_methods.rb', line 3

def __class_states
  @__class_states
end

#__instance_statesObject

Returns the value of attribute __instance_states.



3
4
5
# File 'lib/hyper-store/class_methods.rb', line 3

def __instance_states
  @__instance_states
end

#__shared_statesObject

Returns the value of attribute __shared_states.



3
4
5
# File 'lib/hyper-store/class_methods.rb', line 3

def __shared_states
  @__shared_states
end

Instance Method Details

#mutateObject



16
17
18
# 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) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# 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