Class: Startback::Support::World

Inherits:
Object
  • Object
show all
Includes:
DataObject
Defined in:
lib/startback/support/world.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DataObject

#[], #initialize, #method_missing, #respond_to?, #to_data, #to_json

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Startback::Support::DataObject

Instance Attribute Details

#_factoryObject

Returns the value of attribute _factory.



6
7
8
# File 'lib/startback/support/world.rb', line 6

def _factory
  @_factory
end

#_scopeObject

Returns the value of attribute _scope.



15
16
17
# File 'lib/startback/support/world.rb', line 15

def _scope
  @_scope
end

Instance Method Details

#factory(who, &block) ⇒ Object



9
10
11
12
13
# File 'lib/startback/support/world.rb', line 9

def factory(who, &block)
  dup.tap do |x|
    x._factory = (self._factory || {}).merge(who => block)
  end
end

#with(hash) ⇒ Object



24
25
26
27
28
# File 'lib/startback/support/world.rb', line 24

def with(hash)
  dup.tap do |x|
    x._data = to_data.merge(hash)
  end
end

#with_scope(scope) ⇒ Object



18
19
20
21
22
# File 'lib/startback/support/world.rb', line 18

def with_scope(scope)
  dup.tap do |x|
    x._scope = scope
  end
end