Module: Utusemi
- Defined in:
- lib/utusemi.rb,
lib/utusemi/core.rb,
lib/utusemi/railtie.rb,
lib/utusemi/version.rb,
lib/utusemi/definition.rb,
lib/utusemi/configuration.rb
Defined Under Namespace
Modules: Core
Classes: AttributeDefinitionError, Configuration, Definition, Railtie
Constant Summary
collapse
- VERSION =
'0.0.7'
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
24
25
26
|
# File 'lib/utusemi.rb', line 24
def config
@configuration ||= Configuration.new
end
|
28
29
30
|
# File 'lib/utusemi.rb', line 28
def configure(&block)
config.instance_eval(&block)
end
|
.enable ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/utusemi.rb', line 10
def enable
this = self
ActiveSupport.on_load(:active_record) do
this.include_to_activerecord_base
this.prepend_to_activerecord_base
this.prepend_to_activerecord_relation
this.prepend_to_activerecord_singleton_class
this.prepend_to_activerecord_associations_hasmanyassociation
this.prepend_to_activerecord_associations_collectionproxy
end
end
|
.include_to_activerecord_base ⇒ Object
32
33
34
35
|
# File 'lib/utusemi.rb', line 32
def include_to_activerecord_base
ActiveRecord::Base.send(:include, Core::InstanceMethods)
end
|
.prepend_to_activerecord_associations_collectionproxy ⇒ Object
58
59
60
|
# File 'lib/utusemi.rb', line 58
def prepend_to_activerecord_associations_collectionproxy
ActiveRecord::Associations::CollectionProxy.send(:prepend, Core::ActiveRecord::CollectionProxy) if Rails::VERSION::MAJOR == 3
end
|
.prepend_to_activerecord_associations_hasmanyassociation ⇒ Object
54
55
56
|
# File 'lib/utusemi.rb', line 54
def prepend_to_activerecord_associations_hasmanyassociation
ActiveRecord::Associations::HasManyAssociation.send(:prepend, Core::ActiveRecord::Associations)
end
|
.prepend_to_activerecord_base ⇒ Object
37
38
39
|
# File 'lib/utusemi.rb', line 37
def prepend_to_activerecord_base
ActiveRecord::Base.send(:prepend, Core::ActiveRecord::Base)
end
|
.prepend_to_activerecord_relation ⇒ Object
.prepend_to_activerecord_singleton_class ⇒ Object