Module: LookupBy
- Defined in:
- lib/lookup_by/association.rb,
lib/lookup_by.rb,
lib/lookup_by/cache.rb,
lib/lookup_by/lookup.rb,
lib/lookup_by/railtie.rb,
lib/lookup_by/version.rb,
lib/lookup_by/caching/lru.rb,
lib/lookup_by/hooks/cucumber.rb,
lib/lookup_by/caching/safe_lru.rb,
lib/lookup_by/hooks/formtastic.rb,
lib/lookup_by/hooks/simple_form.rb,
lib/lookup_by/caching/lru_legacy.rb
Overview
TODO: play nicely with belongs_to
TODO: has_many association
class Decision
lookup_for :reasons
end
Decision.first.reasons
=> ["employment", "income"]
Decision.new.reasons = %w(employment income)
Defined Under Namespace
Modules: Association, Caching, Hooks, Lookup
Classes: Cache, Error, Railtie, RecordNotFound
Constant Summary
collapse
- UUID_REGEX =
/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\Z/
- UUID_REGEX_V4 =
/\A\h{8}-\h{4}-4\h{3}-[89aAbB]\h{3}-\h{12}\Z/
- VERSION =
"0.11.1"
Class Method Summary
collapse
Class Method Details
.clear ⇒ Object
39
40
41
|
# File 'lib/lookup_by.rb', line 39
def clear
lookups.each { |lookup| lookup.clear }
end
|
.disable ⇒ Object
43
44
45
|
# File 'lib/lookup_by.rb', line 43
def disable
lookups.each { |lookup| lookup.disable! }
end
|
.enable ⇒ Object
47
48
49
|
# File 'lib/lookup_by.rb', line 47
def enable
lookups.each { |lookup| lookup.enable! }
end
|
.lookups ⇒ Object
35
36
37
|
# File 'lib/lookup_by.rb', line 35
def lookups
classes.map { |klass| klass.lookup }
end
|
.register(klass) ⇒ Object
29
30
31
32
33
|
# File 'lib/lookup_by.rb', line 29
def register(klass)
mutex.synchronize do
self.classes << klass unless classes.include?(klass)
end
end
|
.reload ⇒ Object
51
52
53
|
# File 'lib/lookup_by.rb', line 51
def reload
lookups.each { |lookup| lookup.reload }
end
|