ShogunPanda/brauser

View on GitHub
lib/brauser/definitions/language.rb

Summary

Maintainability
A
0 mins
Test Coverage
#
# This file is part of the brauser gem. Copyright (C) 2013 and above Shogun <shogun@cowtech.it>.
# Licensed under the MIT license, which can be found at https://choosealicense.com/licenses/mit.
#

module Brauser
  module Definitions
    # A definition of a language.
    #
    # @attribute [r] code
    #   @return [String] The language code.
    # @attribute [r] name
    #   @return [String] The language name.
    class Language < Base
      attr_reader :code, :name

      # Creates a new definition.
      #
      # @param code [String] The language code.
      # @param name [String] The language name.
      def initialize(code, name, **_)
        code = code.downcase.gsub("_", "-")
        @id = code.to_sym
        @code = code
        @name = name
      end
    end
  end
end