Sha256: 9fd29aafd83af5dc7203fb5a882d317283c204e2af065ba0e1a07d93c7b5a984

Contents?: true

Size: 427 Bytes

Versions: 33

Compression:

Stored size: 427 Bytes

Contents

module Ddr
  class Language < AuxiliaryResource

    def self.call(obj)
      obj.language.map do |lang|
        find_by_code(lang)
      end
    rescue ActiveResource::ResourceNotFound => e
      raise Ddr::NotFoundError, e
    end

    def self.find_by_code(code)
      return unless code
      new get(:find, code: code)
    end

    def self.codes
      all.map(&:code)
    end

    def to_s
      label
    end

  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
ddr-core-1.4.4 app/models/ddr/language.rb
ddr-core-1.4.3 app/models/ddr/language.rb
ddr-core-1.4.2 app/models/ddr/language.rb
ddr-core-1.4.0 app/models/ddr/language.rb
ddr-core-1.3.0 app/models/ddr/language.rb
ddr-core-1.2.0 app/models/ddr/language.rb
ddr-core-1.2.0.rc3 app/models/ddr/language.rb
ddr-core-1.2.0.rc2 app/models/ddr/language.rb
ddr-core-1.2.0.rc1 app/models/ddr/language.rb
ddr-core-1.1.2 app/models/ddr/language.rb
ddr-core-1.1.1 app/models/ddr/language.rb
ddr-core-1.1.0 app/models/ddr/language.rb
ddr-core-1.0.0 app/models/ddr/language.rb