Sha256: d4b88d3dab0a6add212982b26c43e0aece9fe0f2aa6d2d24822775712b4ac9fe
Contents?: true
Size: 742 Bytes
Versions: 10
Compression:
Stored size: 742 Bytes
Contents
module Hyrax # This is an abstract class to provide select options from a # questioning authority backed authority class QaSelectService attr_reader :authority def initialize(authority_name) @authority = Qa::Authorities::Local.subauthority_for(authority_name) end def select_all_options authority.all.map do |element| [element[:label], element[:id]] end end def select_active_options active_elements.map { |e| [e[:label], e[:id]] } end def active?(id) authority.find(id).fetch('active') end def label(id) authority.find(id).fetch('term') end def active_elements authority.all.select { |e| active?(e.fetch('id')) } end end end
Version data entries
10 entries across 10 versions & 2 rubygems