Module: DataMapper
- Extended by:
- Extlib::Assertions
- Defined in:
- lib/dm-core.rb,
lib/dm-core/type.rb,
lib/dm-core/model.rb,
lib/dm-core/query.rb,
lib/dm-core/version.rb,
lib/dm-core/adapters.rb,
lib/dm-core/model/is.rb,
lib/dm-core/property.rb,
lib/dm-core/resource.rb,
lib/dm-core/collection.rb,
lib/dm-core/migrations.rb,
lib/dm-core/model/hook.rb,
lib/dm-core/query/path.rb,
lib/dm-core/query/sort.rb,
lib/dm-core/repository.rb,
lib/dm-core/types/text.rb,
lib/dm-core/model/scope.rb,
lib/dm-core/transaction.rb,
lib/dm-core/identity_map.rb,
lib/dm-core/property_set.rb,
lib/dm-core/types/object.rb,
lib/dm-core/types/serial.rb,
lib/dm-core/types/boolean.rb,
lib/dm-core/model/property.rb,
lib/dm-core/query/operator.rb,
lib/dm-core/support/logger.rb,
lib/dm-core/query/direction.rb,
lib/dm-core/support/chainable.rb,
lib/dm-core/support/deprecate.rb,
lib/dm-core/support/equalizer.rb,
lib/dm-core/model/relationship.rb,
lib/dm-core/types/discriminator.rb,
lib/dm-core/model/descendant_set.rb,
lib/dm-core/adapters/yaml_adapter.rb,
lib/dm-core/adapters/mysql_adapter.rb,
lib/dm-core/types/paranoid_boolean.rb,
lib/dm-core/adapters/oracle_adapter.rb,
lib/dm-core/associations/one_to_one.rb,
lib/dm-core/types/paranoid_datetime.rb,
lib/dm-core/adapters/sqlite3_adapter.rb,
lib/dm-core/associations/many_to_one.rb,
lib/dm-core/associations/one_to_many.rb,
lib/dm-core/adapters/abstract_adapter.rb,
lib/dm-core/adapters/postgres_adapter.rb,
lib/dm-core/associations/many_to_many.rb,
lib/dm-core/associations/relationship.rb,
lib/dm-core/adapters/in_memory_adapter.rb,
lib/dm-core/query/conditions/operation.rb,
lib/dm-core/support/naming_conventions.rb,
lib/dm-core/query/conditions/comparison.rb,
lib/dm-core/adapters/data_objects_adapter.rb
Overview
TODO: update Model#respond_to? to return true if method_method missing would handle the message
Defined Under Namespace
Modules: Adapters, Associations, Chainable, Deprecate, Equalizer, Migrations, Model, NamingConventions, Resource, Types Classes: Collection, IdentityMap, IncompleteModelError, Logger, ObjectNotFoundError, PluginNotFoundError, Property, PropertySet, Query, Repository, RepositoryNotSetupError, Transaction, Type, UnknownRelationshipError, UnsavedParentError, UpdateConflictError, ValidationError
Constant Summary collapse
- VERSION =
'0.10.1'.freeze
Class Attribute Summary collapse
-
.logger ⇒ Object
Returns the value of attribute logger.
Class Method Summary collapse
-
.repository(name = nil) {|Proc| ... } ⇒ Object
Block Syntax Pushes the named repository onto the context-stack, yields a new session, and pops the context-stack.
-
.root ⇒ Object
private
TODO: document.
-
.setup(*args) ⇒ DataMapper::Adapters::AbstractAdapter
Setups up a connection to a data-store.
- .Type(primitive_type, options = {}) ⇒ Object deprecated Deprecated.
Class Attribute Details
.logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/dm-core/support/logger.rb', line 3 def logger @logger end |
Class Method Details
.repository(name = nil) {|Proc| ... } ⇒ Object
Block Syntax
Pushes the named repository onto the context-stack,
yields a new session, and pops the context-stack.
Non-Block Syntax
Returns the current session, or if there is none,
a new Session.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 |
# File 'lib/dm-core.rb', line 199 def self.repository(name = nil) current_repository = if name assert_kind_of 'name', name, Symbol Repository.context.detect { |repository| repository.name == name } || Repository.new(name) else Repository.context.last || Repository.new(Repository.default_name) end if block_given? current_repository.scope { |*block_args| yield(*block_args) } else current_repository end end |
.root ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
TODO: document
155 156 157 |
# File 'lib/dm-core.rb', line 155 def self.root @root ||= Pathname(__FILE__).dirname.parent..freeze end |
.setup(*args) ⇒ DataMapper::Adapters::AbstractAdapter
Setups up a connection to a data-store
176 177 178 179 180 181 182 183 184 |
# File 'lib/dm-core.rb', line 176 def self.setup(*args) adapter = if args.first.kind_of?(Adapters::AbstractAdapter) args.first else DataMapper::Adapters.new(*args) end Repository.adapters[adapter.name] = adapter end |
.Type(primitive_type, options = {}) ⇒ Object
193 194 195 196 |
# File 'lib/dm-core/type.rb', line 193 def self.Type(primitive_type, = {}) warn "DataMapper.Type(#{primitive_type}) is deprecated, specify the primitive and options explicitly (#{caller[0]})" Class.new(Type).configure(primitive_type, ) end |