Skip to content

Instantly share code, notes, and snippets.

View jfarid27's full-sized avatar
💭

Jalil F. jfarid27

💭
View GitHub Profile
@wycats
wycats / lazy_enumeration.rb
Created March 2, 2013 01:53
Lazy enumerations reduce allocations
class LoggedChar < Struct.new(:char)
def downcase
puts "downcasing #{char}"
char.downcase
end
def capitalized?
puts "capitalized? #{char}"
char =~ /[A-Z]/
end