Sha256: 3d5d418dd9f628d997abc3cd5fbdc3266d4a065e8608598ffd000245ad2d2439

Contents?: true

Size: 425 Bytes

Versions: 4

Compression:

Stored size: 425 Bytes

Contents

module AuthorityService
  extend ActiveSupport::Concern

  included do
    mattr_accessor :authority
  end

  class_methods do
    def select_options
      authority.all.map do |element|
        [element[:label], element[:id]]
      end
    end

    def label(id)
      (authority.find(id) || {}).fetch('term', nil)
    end

    def include?(id)
      !authority.find(id).nil? && !authority.find(id).empty?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
geo_concerns-0.0.4 app/services/authority_service.rb
geo_concerns-0.0.3 app/services/authority_service.rb
geo_concerns-0.0.2 app/services/authority_service.rb
geo_concerns-0.0.1 app/services/authority_service.rb