Skip to content

Instantly share code, notes, and snippets.

@apotheon
Created November 29, 2010 05:38
Show Gist options
  • Select an option

  • Save apotheon/719618 to your computer and use it in GitHub Desktop.

Select an option

Save apotheon/719618 to your computer and use it in GitHub Desktop.
irb vs. rbx
~> irb
irb(main):001:0> foo = {:one => [0,1], :two => 2}
=> {:one=>[0, 1], :two=>2}
irb(main):002:0> File.open('tempfile.txt', 'w') {|f| f.write foo.inspect }
=> 23
irb(main):003:0> bar = Hash.new
=> {}
irb(main):004:0> File.open('tempfile.txt', 'r') {|f| bar = eval(f.read) }
=> {:one=>[0, 1], :two=>2}
irb(main):005:0> p bar
{:one=>[0, 1], :two=>2}
=> nil
irb(main):006:0> exit
~> rbx
irb(main):001:0> foo = {:one => [0,1], :two => 2}
=> {:one=>[0, 1], :two=>2}
irb(main):002:0> File.open('tempfile.txt', 'w') {|f| f.write foo.inspect }
=> 23
irb(main):003:0> bar = Hash.new
=> {}
irb(main):004:0> File.open('tempfile.txt', 'r') {|f| bar = eval(f.read) }
=> {:one=>[0, 1], :two=>2}
irb(main):005:0> p bar
{}
=> nil
irb(main):006:0> exit
~>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment