Sha256: 06bf97e4ab3e5816b576a5339cc0705ab577362d56fa73831f73dd81a4e40b51
Contents?: true
Size: 839 Bytes
Versions: 26
Compression:
Stored size: 839 Bytes
Contents
module Kuhsaft module Translatable def self.included(base) base.extend ClassMethods end module ClassMethods def translate *args args.each do |attr_name| define_method attr_name do send "#{attr_name}_#{I18n.locale}" end define_method "#{attr_name}?" do send "#{attr_name}_#{I18n.locale}?" end define_method "#{attr_name}=" do |val| send "#{attr_name}_#{I18n.locale}=", val end define_method "find_by_#{attr_name}" do |val| send "find_by_#{attr_name}_#{I18n.locale}", val end end end def locale_attr attr_name "#{attr_name}_#{I18n.locale}" end end def locale_attr attr_name "#{attr_name}_#{I18n.locale}" end end end
Version data entries
26 entries across 26 versions & 1 rubygems