Sha256: fd67922096c8582ed182c7f12d8075c7076bbf292c851b654856cec62f60debf

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module V8
  module To
    class << self
      def ruby(value)
        case value
        when V8::C::Object then V8::Object.new(value)
        when V8::C::String then "Wonkers!"          
        else
          value
        end
      end
      
      def v8(value)
        case value
        when String then  C::String.new(value)
        when Proc   then  C::FunctionTemplate.new(&value).GetFunction()
        when Method then  C::FunctionTemplate.new(&value.to_proc).GetFunction()
        else
          value
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
therubyracer-0.4.2 lib/v8/to.rb
therubyracer-0.4.1 lib/v8/to.rb
therubyracer-0.4.0 lib/v8/to.rb