Module: RKit::ActiveRecordUtility::ActiveRecordExtend
- Extended by:
- ActiveRecordExtend
- Included in:
- ActiveRecordExtend
- Defined in:
- lib/r_kit/active_record_utility/active_record_extend.rb
Instance Method Summary collapse
- #collection_finder(**options) ⇒ Object
- #instance_finder(**options) ⇒ Object
- #interfered?(utility) ⇒ Boolean
- #interferences_options_get(utility = @_active_record_utilities_self) ⇒ Object
- #interferences_options_set(utility, **options) ⇒ Object
Instance Method Details
#collection_finder(**options) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/r_kit/active_record_utility/active_record_extend.rb', line 27 def collection_finder ** collection = all collection = collection.pool [:pool] if interfered? :pool collection = collection.published.publication_desc if interfered? :publisher collection = collection.series [:series] if interfered? :series collection end |
#instance_finder(**options) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/r_kit/active_record_utility/active_record_extend.rb', line 35 def instance_finder ** if interfered? :tag tagged [:tag] else find_by id: [:id] end end |
#interfered?(utility) ⇒ Boolean
20 21 22 23 24 |
# File 'lib/r_kit/active_record_utility/active_record_extend.rb', line 20 def interfered? utility RKit::ActiveRecordUtility::Base.const_get(utility.classify).interfered? self rescue NameError false end |
#interferences_options_get(utility = @_active_record_utilities_self) ⇒ Object
15 16 17 |
# File 'lib/r_kit/active_record_utility/active_record_extend.rb', line 15 def utility = @_active_record_utilities_self instance_variable_get "@_active_record_utilities_#{ utility }_options" end |
#interferences_options_set(utility, **options) ⇒ Object
10 11 12 13 |
# File 'lib/r_kit/active_record_utility/active_record_extend.rb', line 10 def utility, ** instance_variable_set "@_active_record_utilities_self", utility instance_variable_set "@_active_record_utilities_#{ utility }_options", end |