Module: Stator::Model
- Defined in:
- lib/stator/model.rb
Defined Under Namespace
Modules: InstanceMethods, TrackerMethods
Instance Method Summary
collapse
Instance Method Details
#_stator(namespace) ⇒ Object
22
23
24
|
# File 'lib/stator/model.rb', line 22
def _stator(namespace)
self._stators[namespace.to_s]
end
|
#stator(options = {}, &block) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/stator/model.rb', line 4
def stator(options = {}, &block)
class_attribute :_stators unless respond_to?(:_stators)
include InstanceMethods unless self.included_modules.include?(InstanceMethods)
include TrackerMethods if options[:track] == true
self._stators ||= {}
machine = (self._stators[options[:namespace].to_s] ||= ::Stator::Machine.new(self, options))
if block_given?
machine.instance_eval(&block)
machine.evaluate
end
machine
end
|