class LittleWeasel::DictionaryKey

This class describes a unique key associated with a particular dictionary file. Dictionary keys are used to identify a dictionary on which an action should be performed.

Attributes

language[RW]
region[RW]

Public Class Methods

key(language:, region: nil, tag: nil) click to toggle source
# File lib/LittleWeasel/dictionary_key.rb, line 39
def key(language:, region: nil, tag: nil)
  new(language: language, region: region, tag: tag).key
end
new(language:, region: nil, tag: nil) click to toggle source
# File lib/LittleWeasel/dictionary_key.rb, line 20
def initialize(language:, region: nil, tag: nil)
  validate_language language: language
  self.language = self.class.normalize_language language

  validate_region region: region
  self.region = self.class.normalize_region region

  validate_tag tag: tag
  self.tag = tag
end

Public Instance Methods

key() click to toggle source
# File lib/LittleWeasel/dictionary_key.rb, line 31
def key
  return locale unless tagged?

  "#{locale}-#{tag}"
end
Also aliased as: to_s
to_s()
Alias for: key