Sha256: eb5a588ebb4afe6f1f502ac9e7a34b57e6da67271794dab8a8ecc1b6376f4971
Contents?: true
Size: 737 Bytes
Versions: 12
Compression:
Stored size: 737 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| e.fetch('active') } end end end
Version data entries
12 entries across 12 versions & 1 rubygems