Sha256: a82cd7b929a49edb07da11393ce2de583ad0a667d9968cf032a6557079f156f0

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

module Gherkin
  module Rubify
    if defined?(JRUBY_VERSION)
      # Translate Java objects to Ruby.
      # This is especially important to convert java.util.List coming
      # from Java and back to a Ruby Array.
      def rubify(o)
        case(o)
        when Java.java.util.Collection, Array
          o.map{|e| rubify(e)}
        when Java.gherkin.formatter.model.PyString
          require 'gherkin/formatter/model'
          Formatter::Model::PyString.new(o.value, o.line)
        else
          o
        end
      end
    elsif defined?(V8)
      case(o)
      when V8::Array
        o.map{|e| rubify(e)}
      else
        o
      end
    else
      def rubify(o)
        o
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gherkin-2.3.6 lib/gherkin/rubify.rb
gherkin-2.3.6-x86-mswin32 lib/gherkin/rubify.rb
gherkin-2.3.6-x86-mingw32 lib/gherkin/rubify.rb
gherkin-2.3.6-universal-dotnet lib/gherkin/rubify.rb
gherkin-2.3.6-java lib/gherkin/rubify.rb