Sha256: db3e6eab60ef8c78017ad7991b0d105e510d442f07e349200afac7f4bccd599c
Contents?: true
Size: 847 Bytes
Versions: 24
Compression:
Stored size: 847 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_singleton_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
24 entries across 24 versions & 1 rubygems