Sha256: 5f78b1219d47a32c057509a561ecfa66f3bd2cc0fcc544c3f4197b21ee1a85ed
Contents?: true
Size: 470 Bytes
Versions: 47
Compression:
Stored size: 470 Bytes
Contents
# frozen_string_literal: true module Alchemy::Language::Code extend ActiveSupport::Concern def code [language_code, country_code].select(&:present?).join("-") end def code=(code) self.language_code = code end module ClassMethods def find_by_code(code) codes = code.split("-") codes << "" if codes.length == 1 on_current_site.find_by( language_code: codes[0], country_code: codes[1] ) end end end
Version data entries
47 entries across 47 versions & 1 rubygems