Sha256: 9c29a5b7f7a93354759802477a45e4d2e21d245622b314d0c0e679ecb10bc18f
Contents?: true
Size: 471 Bytes
Versions: 88
Compression:
Stored size: 471 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
88 entries across 88 versions & 1 rubygems