Sha256: 60ef7ba7265cc3b9aa0dec703044300f1dcc1b2735e6271689d829a2f00c24ae

Contents?: true

Size: 687 Bytes

Versions: 11

Compression:

Stored size: 687 Bytes

Contents

module Less
  module JavaScript
    
    def self.default_context_wrapper
      if defined?(JRUBY_VERSION)
        require 'less/java_script/rhino_context'
        RhinoContext
      else
        require 'less/java_script/v8_context'
        V8Context
      end
    end
    
    @@context_wrapper = nil
    
    def self.context_wrapper
      @@context_wrapper ||= default_context_wrapper
    end
    
    def self.context_wrapper=(klass)
      @@context_wrapper = klass
    end
    
    # execute a block as JS
    def self.exec(&block)
      context_wrapper.instance.exec(&block)
    end
    
    def self.eval(source)
      context_wrapper.instance.eval(source)
    end
    
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
less-2.6.0 lib/less/java_script.rb
less-2.5.1 lib/less/java_script.rb
less-2.5.0 lib/less/java_script.rb
less-2.4.0 lib/less/java_script.rb
less-2.3.3 lib/less/java_script.rb
less-2.3.2 lib/less/java_script.rb
less-2.3.1 lib/less/java_script.rb
less-2.3.0 lib/less/java_script.rb
less-2.2.2 lib/less/java_script.rb
less-2.2.1 lib/less/java_script.rb
less-2.2.0 lib/less/java_script.rb