Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active June 24, 2016 00:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/569af2e526cda3bc0b66da8c5aaf4a00 to your computer and use it in GitHub Desktop.
Save havenwood/569af2e526cda3bc0b66da8c5aaf4a00 to your computer and use it in GitHub Desktop.
foo bar bar
module FooBarBaz
def self.call from: 1, to: 100
from.upto to do |i|
yield case [i.modulo(5).zero?, i.modulo(7).zero?]
when [true, true] then 'foo'
when [true, false] then 'bar'
when [false, true] then 'baz'
else i
end
end
end
end
FooBarBaz.call(from: 1, to: 35) { |n| puts n }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment