Sha256: 4cc92db0270b70d51fdf1ab3e40a17fe4438a68898abd993f922107c2b6ddbf0
Contents?: true
Size: 391 Bytes
Versions: 65
Compression:
Stored size: 391 Bytes
Contents
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 find_by_language_code_and_country_code *codes end end end
Version data entries
65 entries across 65 versions & 2 rubygems