Created
November 14, 2011 18:03
-
-
Save colindean/1364624 to your computer and use it in GitHub Desktop.
Java converts the return of Hash#select to an array when using a JRuby warbled jar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#put this in ./bin/ | |
#this should demonstrate that a ruby hash gets converted to an array when | |
#warbled | |
hashme = {'stringhash' => 'foo', :symbol_hash => 'sdfdf', 'nilvalue' => nil} | |
puts "Should be Hash: #{hashme.class.to_s}" | |
hashme = hashme.select {|k,v| !v.nil?} | |
puts "Should be Hash: #{hashme.class.to_s}" | |
hashme = {'stringhash' => 'foo', :symbol_hash => 'sdfdf', 'nilvalue' => nil} | |
hashme = hashme.reject {|k,v| v.nil?} | |
puts "Should be Hash: #{hashme.class.to_s}" | |
#this is what happens: | |
#[cdean@flyingbantha jruby-hash-array-problem]$ ruby bin/jruby-hash-array-problem.rb | |
#Should be Hash: Hash | |
#Should be Hash: Hash | |
#Should be Hash: Hash | |
#[cdean@flyingbantha jruby-hash-array-problem]$ warble | |
#Creating jruby-hash-array-problem.jar | |
#[cdean@flyingbantha jruby-hash-array-problem]$ java -jar jruby-hash-array-problem.jar | |
#Should be Hash: Hash | |
#Should be Hash: Array | |
#Should be Hash: Hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#put this in ./config/ | |
#note: I grep -v'd the commented lines from this for brevity | |
Warbler::Config.new do |config| | |
config.features = %w(gemjar compiled) | |
config.dirs = %w(config bin) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment