Skip to content

Instantly share code, notes, and snippets.

@tagomoris
Created March 23, 2012 01:58
Show Gist options
  • Save tagomoris/2166154 to your computer and use it in GitHub Desktop.
Save tagomoris/2166154 to your computer and use it in GitHub Desktop.
1.9.3p125 :001 > require 'yajl'
=> true
1.9.3p125 :002 > y.on_parse_complete = lambda {|msg| p msg}
NameError: undefined local variable or method `y' for main:Object
from (irb):2
from /Users/tagomoris/.rvm/rubies/ruby-1.9.3-p125/bin/irb:16:in `<main>'
1.9.3p125 :003 > y = Yajl::Parser.new
=> #<Yajl::Parser:0x007fd2fc92ce90>
1.9.3p125 :004 > y.on_parse_complete = lambda {|msg| p msg}
=> #<Proc:0x007fd2fc926108@(irb):4 (lambda)>
1.9.3p125 :005 > y << '{"message":1}'
{"message"=>1}
=> nil
1.9.3p125 :006 > ^D
tagomoris$ gem list
*** LOCAL GEMS ***
rake (0.8.7)
yajl-ruby (1.1.0)
tagomoris$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment