Created
February 5, 2010 18:29
-
-
Save djsun/296063 to your computer and use it in GitHub Desktop.
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
$ ruby --version | |
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10] | |
$ gem list | grep json | |
json (1.2.0) | |
json_pure (1.2.0) | |
$ gem list | grep activesupport | |
activesupport (2.3.5) |
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
# add this line before requiring 'json' or 'active_support': | |
require 'generator.rb' | |
# I figured this out by reading: | |
# https://rails.lighthouseapp.com/projects/8994/tickets/2942-enumerableenumeratornext-causes-stack-level-too-deep-since-activesupport-233 |
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
require 'rubygems' | |
require 'ruby-debug' | |
require 'json' | |
class Stream | |
def initialize | |
@data = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | |
@iterator = @data.each | |
end | |
def fetch | |
@iterator.next | |
end | |
end | |
def main | |
data = Stream.new | |
debugger | |
loop do | |
x = data.fetch | |
puts x | |
end | |
end | |
main |
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
$ ruby fail_1.rb | |
fail_1.rb:19 | |
loop do | |
(rdb:1) s | |
fail_1.rb:20 | |
x = data.fetch | |
(rdb:1) s | |
fail_1.rb:12 | |
@iterator.next | |
(rdb:1) s | |
fail_1.rb:12:in `next': stack level too deep (SystemStackError) | |
from fail_1.rb:12:in `fetch' | |
from fail_1.rb:20:in `main' | |
from fail_1.rb:19:in `loop' | |
from fail_1.rb:19:in `main' | |
from fail_1.rb:25 |
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
require 'rubygems' | |
require 'ruby-debug' | |
require 'active_support' | |
class Stream | |
def initialize | |
@data = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | |
@iterator = @data.each | |
end | |
def fetch | |
@iterator.next | |
end | |
end | |
def main | |
data = Stream.new | |
debugger | |
loop do | |
x = data.fetch | |
puts x | |
end | |
end | |
main |
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
brooklyn:iter djsun$ ruby fail_2.rb | |
fail_2.rb:19 | |
loop do | |
(rdb:1) s | |
fail_2.rb:20 | |
x = data.fetch | |
(rdb:1) s | |
fail_2.rb:12 | |
@iterator.next | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:84 | |
result = blank_slate_method_added(name) | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:84 | |
result = blank_slate_method_added(name) | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:84 | |
result = blank_slate_method_added(name) | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:84 | |
result = blank_slate_method_added(name) | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:85 | |
return result if self != Object | |
(rdb:1) s | |
/Users/djsun/.gem/ruby/1.8/gems/builder-2.1.2/lib/blankslate.rb:84 | |
result = blank_slate_method_added(name) | |
(rdb:1) | |
... |
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
class Stream | |
def initialize | |
@data = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55] | |
@iterator = @data.each | |
end | |
def fetch | |
@iterator.next | |
end | |
end | |
def main | |
data = Stream.new | |
loop do | |
puts data.fetch | |
end | |
end | |
main |
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
1 | |
1 | |
2 | |
3 | |
5 | |
8 | |
13 | |
21 | |
34 | |
55 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment