Sha256: c6dd9ce2cfbc30aad39014caf737bd47b209e2e6ebb5edbc0078972fcf5501c8

Contents?: true

Size: 861 Bytes

Versions: 29

Compression:

Stored size: 861 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
            rubified_array = o.map{ |e| rubify(e) }
            if o.respond_to?(:line)
              class << rubified_array
                attr_accessor :line
              end
              rubified_array.line = o.line
            end
            rubified_array
          when Java.gherkin.formatter.model.DocString
            require 'gherkin/formatter/model'
            Formatter::Model::DocString.new(o.content_type, o.value, o.line)
          else
            o
        end
      end
    else
      def rubify(o)
        o
      end
    end
  end
end

Version data entries

29 entries across 27 versions & 3 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/gherkin-2.12.2/lib/gherkin/rubify.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/gherkin-2.12.2/lib/gherkin/rubify.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/gherkin-2.12.2/lib/gherkin/rubify.rb
gherkin-2.12.2 lib/gherkin/rubify.rb
gherkin-2.12.2-x86-mswin32 lib/gherkin/rubify.rb
gherkin-2.12.2-x86-mingw32 lib/gherkin/rubify.rb
gherkin-2.12.2-java lib/gherkin/rubify.rb
gherkin-2.12.1 lib/gherkin/rubify.rb
gherkin-2.12.1-x86-mswin32 lib/gherkin/rubify.rb
gherkin-2.12.1-x86-mingw32 lib/gherkin/rubify.rb
gherkin-2.12.1-java lib/gherkin/rubify.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/gherkin-2.11.6/lib/gherkin/rubify.rb
gherkin-2.12.0 lib/gherkin/rubify.rb
gherkin-2.12.0-x86-mingw32 lib/gherkin/rubify.rb
gherkin-2.12.0-x86-mswin32 lib/gherkin/rubify.rb
gherkin-2.12.0-java lib/gherkin/rubify.rb
gherkin-2.11.8 lib/gherkin/rubify.rb
gherkin-2.11.8-x86-mswin32 lib/gherkin/rubify.rb
gherkin-2.11.8-x86-mingw32 lib/gherkin/rubify.rb
gherkin-2.11.8-java lib/gherkin/rubify.rb