Sha256: 4f39f50d41b591a0939fd960aea83042a38d7ff45d0eec95c64f2f9b33fdf0cb

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 Bytes

Contents

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

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

1 entries across 1 versions & 1 rubygems

Version Path
less_simple-0.1.4 lib/less_simple.rb