Module: Toy
- Extended by:
- Toy
- Included in:
- Toy
- Defined in:
- lib/toy.rb,
lib/toy/list.rb,
lib/toy/dirty.rb,
lib/toy/lists.rb,
lib/toy/store.rb,
lib/toy/logger.rb,
lib/toy/object.rb,
lib/toy/caching.rb,
lib/toy/inspect.rb,
lib/toy/plugins.rb,
lib/toy/version.rb,
lib/toy/equality.rb,
lib/toy/identity.rb,
lib/toy/querying.rb,
lib/toy/attribute.rb,
lib/toy/callbacks.rb,
lib/toy/cloneable.rb,
lib/toy/reference.rb,
lib/toy/attributes.rb,
lib/toy/exceptions.rb,
lib/toy/references.rb,
lib/toy/reloadable.rb,
lib/toy/timestamps.rb,
lib/toy/dirty_store.rb,
lib/toy/inheritance.rb,
lib/toy/persistence.rb,
lib/toy/validations.rb,
lib/toy/identity_map.rb,
lib/toy/proxies/list.rb,
lib/toy/proxies/proxy.rb,
lib/toy/serialization.rb,
lib/toy/extensions/set.rb,
lib/toy/extensions/date.rb,
lib/toy/extensions/hash.rb,
lib/toy/extensions/time.rb,
lib/toy/extensions/array.rb,
lib/toy/extensions/float.rb,
lib/toy/extensions/object.rb,
lib/toy/extensions/string.rb,
lib/toy/extensions/boolean.rb,
lib/toy/extensions/integer.rb,
lib/toy/extensions/nil_class.rb,
lib/toy/middleware/identity_map.rb,
lib/toy/mass_assignment_security.rb,
lib/toy/association_serialization.rb,
lib/toy/identity/uuid_key_factory.rb,
lib/toy/identity/abstract_key_factory.rb
Defined Under Namespace
Modules: AssociationSerialization, Attributes, Caching, Callbacks, Cloneable, Dirty, DirtyStore, Equality, Extensions, Identity, IdentityMap, Inheritance, Inspect, Lists, Logger, MassAssignmentSecurity, Middleware, Object, Persistence, Plugins, Proxies, Querying, References, Reloadable, Serialization, Store, Timestamps, Validations
Classes: Attribute, AttributeNotDefined, Error, InvalidKey, InvalidKeyFactory, List, NotFound, RecordInvalid, Reference
Constant Summary
collapse
- VERSION =
"0.11.0"
Instance Method Summary
collapse
Instance Method Details
Clears all the adapters for all the models. Useful in specs/tests/etc. Do not use in production, harty harr harr.
Note: that if your models are auto-loaded like in Rails, you will need to make sure they are loaded in order to clear them or ToyStore will not be aware of their existence.
34
35
36
37
38
39
|
# File 'lib/toy.rb', line 34
def clear
models.each do |model|
model.adapter.clear
end
IdentityMap.clear
end
|
#key_factory=(key_factory) ⇒ Object
53
54
55
|
# File 'lib/toy.rb', line 53
def key_factory=(key_factory)
@key_factory = key_factory
end
|
41
42
43
|
# File 'lib/toy.rb', line 41
def logger
@logger
end
|
#logger=(logger) ⇒ Object
49
50
51
|
# File 'lib/toy.rb', line 49
def logger=(logger)
@logger = logger
end
|
45
46
47
|
# File 'lib/toy.rb', line 45
def logger?
@logger.present?
end
|
2
3
4
|
# File 'lib/toy/plugins.rb', line 2
def models
Toy::Store.direct_descendants
end
|
#plugin(mod) ⇒ Object
10
11
12
|
# File 'lib/toy/plugins.rb', line 10
def plugin(mod)
Toy::Store.plugin(mod)
end
|
6
7
8
|
# File 'lib/toy/plugins.rb', line 6
def plugins
Toy::Store.plugins
end
|
Resets all tracking of things in memory. Useful for running before each request in development mode with Rails and such.
22
23
24
25
26
|
# File 'lib/toy.rb', line 22
def reset
IdentityMap.clear
plugins.clear
models.clear
end
|