lib/traco/class_methods.rb in traco-3.2.1 vs lib/traco/class_methods.rb in traco-4.0.0
- old
+ new
@@ -1,20 +1,20 @@
module Traco
module ClassMethods
def locales_for_attribute(attribute)
- traco_cache(attribute, LocaleFallbacks::DEFAULT_FIRST_FALLBACK).keys
+ traco_cache(attribute, fallback: LocaleFallbacks::DEFAULT_FIRST_FALLBACK).keys
end
def locale_columns(*attributes)
attributes.each_with_object([]) do |attribute, columns|
- columns.concat(_locale_columns_for_attribute(attribute, LocaleFallbacks::DEFAULT_FIRST_FALLBACK))
+ columns.concat(_locale_columns_for_attribute(attribute, fallback: LocaleFallbacks::DEFAULT_FIRST_FALLBACK))
end
end
# Consider this method internal.
- def _locale_columns_for_attribute(attribute, fallback)
- traco_cache(attribute, fallback).values
+ def _locale_columns_for_attribute(attribute, fallback:)
+ traco_cache(attribute, fallback: fallback).values
end
def current_locale_column(attribute)
Traco.column(attribute, I18n.locale)
end
@@ -50,10 +50,10 @@
# default: { :sv => :title_sv, :en => :title_en },
# any: { :sv => :title_sv, :en => :title_en, :"pt-BR" => :title_pt_br }
# }
# }
# }
- def traco_cache(attribute, fallback)
+ def traco_cache(attribute, fallback:)
cache = @traco_cache ||= {}
per_locale_cache = cache[I18n.locale] ||= {}
per_attribute_cache = per_locale_cache[attribute] ||= {}
per_attribute_cache[fallback] ||= begin