Sha256: cef1e24e4243f03c716d823f1ae1d0e7fbd1e2cae7cf852edf8c93b01bd72772

Contents?: true

Size: 956 Bytes

Versions: 2

Compression:

Stored size: 956 Bytes

Contents

gem 'activesupport', '2.3.5'
require 'active_support/vendor'

module I18n
  module Backend
    class LessSimple < Simple
      attr_accessor :interpolation_defaults

      def translate(locale, key, options = {})
        options = (interpolation_defaults || {}).merge options
        super locale, key, options
      end
    end
  end
end

class LessSimple
  @@klass = I18n::Backend::Simple
  
  def self.klass= val
    @@klass = val
  end

  def self.klass
    @@klass
  end

  def self.factory_backend
    subclass.new
  end

  def self.subclass
    subclass = eval("class LessSimple::#{klass.to_s.gsub('::', '')} < #{klass}; self; end")

    subclass.class_eval do
      attr_accessor :interpolation_defaults
      include InstanceMethods
    end
  
    subclass
  end

  module InstanceMethods
    def translate(locale, key, options = {})
      options = (interpolation_defaults || {}).merge options
      super locale, key, options
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
less_simple-0.1.2 lib/less_simple.rb
less_simple-0.1.1 lib/less_simple.rb