Class: PeakFlowUtils::SimpleFormHandler
Instance Method Summary
collapse
#add_translations_for_hash, #translations_for_hash_recursive
Instance Method Details
#enabled? ⇒ Boolean
2
3
4
|
# File 'app/handlers/peak_flow_utils/simple_form_handler.rb', line 2
def enabled?
::Object.const_defined?(:SimpleForm)
end
|
#groups ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# File 'app/handlers/peak_flow_utils/simple_form_handler.rb', line 6
def groups
ArrayEnumerator.new do |yielder|
PeakFlowUtils::ModelInspector.model_classes.each do |model_inspector|
yielder << PeakFlowUtils::GroupService.new(
id: model_inspector.clazz.name,
handler: self
)
end
end
end
|
#translations_for_group(group) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'app/handlers/peak_flow_utils/simple_form_handler.rb', line 17
def translations_for_group(group)
ArrayEnumerator.new do |yielder|
model_inspector = PeakFlowUtils::ModelInspector.model_classes.find { |model_inspector_i| model_inspector_i.clazz.name == group.name }
raise "No inspector by that name: #{group.name}" unless model_inspector
simple_form_translations(model_inspector).each { |translation| yielder << translation }
end
end
|