Module: RightsService
- Defined in:
- app/services/rights_service.rb
Class Method Summary collapse
- .active?(id) ⇒ Boolean
- .active_elements ⇒ Object
- .label(id) ⇒ Object
- .select_active_options ⇒ Object
- .select_all_options ⇒ Object
Class Method Details
.active?(id) ⇒ Boolean
15 16 17 |
# File 'app/services/rights_service.rb', line 15 def self.active?(id) .find(id).fetch('active') end |
.active_elements ⇒ Object
23 24 25 |
# File 'app/services/rights_service.rb', line 23 def self.active_elements .all.select { |e| .find(e[:id])[:active] } end |
.label(id) ⇒ Object
19 20 21 |
# File 'app/services/rights_service.rb', line 19 def self.label(id) .find(id).fetch('term') end |
.select_active_options ⇒ Object
11 12 13 |
# File 'app/services/rights_service.rb', line 11 def self. active_elements.map { |e| [e[:label], e[:id]] } end |
.select_all_options ⇒ Object
5 6 7 8 9 |
# File 'app/services/rights_service.rb', line 5 def self. .all.map do |element| [element[:label], element[:id]] end end |