Module: Horza
- Defined in:
- lib/horza/shared_config.rb,
lib/horza.rb,
lib/horza/errors.rb,
lib/horza/version.rb,
lib/horza/entities.rb,
lib/horza/configuration.rb,
lib/horza/entities/single.rb,
lib/horza/adapters/options.rb,
lib/horza/dependency_loading.rb,
lib/horza/entities/collection.rb,
lib/horza/adapters/class_methods.rb,
lib/horza/core_extensions/string.rb,
lib/horza/adapters/abstract_adapter.rb,
lib/horza/adapters/instance_methods.rb,
lib/horza/adapters/active_record/arel_join.rb,
lib/horza/entities/single_with_active_model.rb,
lib/horza/adapters/active_record/active_record.rb
Overview
Helper module to allow other libraries to access the global Horza configuration instance and dispatch methods accordingly.
Defined Under Namespace
Modules: Adapters, CoreExtensions, DependencyLoading, Entities, Errors, SharedConfig
Classes: Configuration
Constant Summary
collapse
- VERSION =
'1.0.2'
Class Method Summary
collapse
Class Method Details
.adapt(klass) ⇒ Object
43
44
45
|
# File 'lib/horza.rb', line 43
def adapt(klass)
adapter.new(klass)
end
|
.collection(items = []) ⇒ Object
.configuration ⇒ Object
27
28
29
|
# File 'lib/horza.rb', line 27
def configuration
@configuration ||= Configuration.new
end
|
35
36
37
|
# File 'lib/horza.rb', line 35
def configure
yield(configuration)
end
|
.descendants_map(klass) ⇒ Object
39
40
41
|
# File 'lib/horza.rb', line 39
def descendants_map(klass)
klass.descendants.reduce({}) { |hash, (klass)| hash.merge(klass.name.split('::').last.underscore.to_sym => klass) }
end
|
.reset ⇒ Object
31
32
33
|
# File 'lib/horza.rb', line 31
def reset
@configuration = nil
end
|
.single(params = {}) ⇒ Object