language_presenter.rb 313 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. class LanguagePresenter < ActiveModelSerializers::Model
  3. attributes :code, :name, :native_name
  4. def initialize(code)
  5. super()
  6. @code = code
  7. @item = LanguagesHelper::SUPPORTED_LOCALES[code]
  8. end
  9. def name
  10. @item[0]
  11. end
  12. def native_name
  13. @item[1]
  14. end
  15. end