Skip to content

Instantly share code, notes, and snippets.

@rdammkoehler
Created December 13, 2016 19:55
Show Gist options
  • Select an option

  • Save rdammkoehler/718112d21d4bd68500f347e18c478fa7 to your computer and use it in GitHub Desktop.

Select an option

Save rdammkoehler/718112d21d4bd68500f347e18c478fa7 to your computer and use it in GitHub Desktop.
return chain with gimme in ruby
require 'gimme'
class C
def f
return 1
end
end
l = [ 2, 3, 4, 5 ]
c = gimme(C)
give(c).f() { l.pop }
4.times {
puts c.f
}
# /Users/rich/.rvm/rubies/ruby-2.2.3/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/rich/projects/HISC/DC_ClearCare_Collector_rb/x.rb
# 5
# 4
# 3
# 2
#
# Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment