Module: Ripple
- Defined in:
- lib/ripple.rb,
lib/ripple/indexes.rb,
lib/ripple/railtie.rb,
lib/ripple/version.rb,
lib/ripple/document.rb,
lib/ripple/callbacks.rb,
lib/ripple/conversion.rb,
lib/ripple/inspection.rb,
lib/ripple/observable.rb,
lib/ripple/properties.rb,
lib/ripple/timestamps.rb,
lib/ripple/test_server.rb,
lib/ripple/translation.rb,
lib/ripple/validations.rb,
lib/ripple/associations.rb,
lib/ripple/document/key.rb,
lib/ripple/document/link.rb,
lib/ripple/serialization.rb,
lib/ripple/associations/one.rb,
lib/ripple/document/finders.rb,
lib/ripple/associations/many.rb,
lib/ripple/attribute_methods.rb,
lib/ripple/conflict/resolver.rb,
lib/ripple/embedded_document.rb,
lib/ripple/nested_attributes.rb,
lib/ripple/associations/proxy.rb,
lib/ripple/associations/linked.rb,
lib/ripple/conflict/test_helper.rb,
lib/ripple/document/persistence.rb,
lib/ripple/associations/embedded.rb,
lib/ripple/attribute_methods/read.rb,
lib/ripple/document/bucket_access.rb,
lib/ripple/property_type_mismatch.rb,
lib/ripple/attribute_methods/dirty.rb,
lib/ripple/attribute_methods/query.rb,
lib/ripple/attribute_methods/write.rb,
lib/ripple/conflict/basic_resolver.rb,
lib/ripple/conflict/document_hooks.rb,
lib/ripple/embedded_document/finders.rb,
lib/rails/generators/ripple_generator.rb,
lib/ripple/associations/instantiators.rb,
lib/ripple/associations/one_key_proxy.rb,
lib/ripple/associations/one_linked_proxy.rb,
lib/ripple/embedded_document/persistence.rb,
lib/ripple/associations/many_linked_proxy.rb,
lib/ripple/associations/one_embedded_proxy.rb,
lib/rails/generators/ripple/js/js_generator.rb,
lib/ripple/associations/many_embedded_proxy.rb,
lib/ripple/validations/associated_validator.rb,
lib/ripple/associations/many_reference_proxy.rb,
lib/ripple/associations/one_stored_key_proxy.rb,
lib/ripple/associations/many_stored_key_proxy.rb,
lib/ripple/embedded_document/around_callbacks.rb,
lib/rails/generators/ripple/test/test_generator.rb,
lib/rails/generators/ripple/model/model_generator.rb,
lib/rails/generators/ripple/observer/observer_generator.rb,
lib/rails/generators/ripple/configuration/configuration_generator.rb
Overview
Contains the classes and modules related to the ODM built on top of the basic Riak client.
Defined Under Namespace
Modules: Associations, AttributeMethods, Callbacks, Conflict, Conversion, Document, EmbeddedDocument, Generators, Indexes, Inspection, NestedAttributes, Observable, Properties, Serialization, Timestamps, Translation, Validations Classes: Association, DocumentInvalid, DocumentNotFound, Index, MissingConfiguration, NoRootDocument, Property, PropertyTypeMismatch, Railtie, TestServer
Constant Summary collapse
- VERSION =
"1.0.0"
- Translator =
A dummy object so translations can be accessed without module inclusion.
Object.new.tap {|o| o.extend Translation }
Class Method Summary collapse
-
.client ⇒ Riak::Client
The client for the current thread.
-
.client=(value) ⇒ Object
Sets the client for the current thread.
-
.config ⇒ Object
Reads the global Ripple configuration.
-
.config=(hash) ⇒ Object
Sets the global Ripple configuration.
-
.date_format ⇒ Symbol
The format in which date/time objects will be serialized to strings in JSON.
-
.date_format=(format) ⇒ Object
Sets the format for date/time objects that are serialized to JSON.
-
.load_configuration(config_file, config_keys = [:ripple]) ⇒ Object
(also: load_config)
Loads the Ripple configuration from a given YAML file.
Class Method Details
.client ⇒ Riak::Client
Returns The client for the current thread.
15 16 17 |
# File 'lib/ripple.rb', line 15 def client Thread.current[:ripple_client] ||= Riak::Client.new(client_config) end |
.client=(value) ⇒ Object
Sets the client for the current thread.
21 22 23 |
# File 'lib/ripple.rb', line 21 def client=(value) Thread.current[:ripple_client] = value end |
.config ⇒ Object
Reads the global Ripple configuration.
32 33 34 |
# File 'lib/ripple.rb', line 32 def config @config ||= {} end |
.config=(hash) ⇒ Object
Sets the global Ripple configuration.
26 27 28 29 |
# File 'lib/ripple.rb', line 26 def config=(hash) self.client = nil @config = hash.symbolize_keys end |
.date_format ⇒ Symbol
The format in which date/time objects will be serialized to strings in JSON. Defaults to :iso8601, and can be set in Ripple.config.
40 41 42 |
# File 'lib/ripple.rb', line 40 def date_format (config[:date_format] ||= :iso8601).to_sym end |
.date_format=(format) ⇒ Object
Sets the format for date/time objects that are serialized to JSON.
47 48 49 |
# File 'lib/ripple.rb', line 47 def date_format=(format) config[:date_format] = format.to_sym end |
.load_configuration(config_file, config_keys = [:ripple]) ⇒ Object Also known as: load_config
Loads the Ripple configuration from a given YAML file. Evaluates the configuration with ERB before loading.
53 54 55 56 57 58 59 60 61 |
# File 'lib/ripple.rb', line 53 def load_configuration(config_file, config_keys = [:ripple]) config_file = File.(config_file) config_hash = YAML.load(ERB.new(File.read(config_file)).result).with_indifferent_access config_keys.each {|k| config_hash = config_hash[k]} configure_ports(config_hash) self.config = config_hash || {} rescue Errno::ENOENT raise Ripple::MissingConfiguration.new(config_file) end |