This file contains hidden or 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
# before | |
class X | |
# imperative, affects system state, depends on globals | |
def self.x | |
puts Config.data | |
end | |
end | |
X.x |
This file contains hidden or 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 Object | |
# as inspired by bash | |
def tee(*functions) | |
self.tap do | |
args.map { |arg| arg.call(self) } | |
end | |
end | |
end | |
class SomeClass |
This file contains hidden or 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
letters = "ABCDEFGHIJKLMNOPRSTUVWXYZ" | |
map = {} | |
letters.each_char.each_with_index do |c, i| | |
map[c] = letters[(i+13)%26] | |
end | |
map.keys.each do |k| | |
map[k.downcase] = map[k].downcase | |
end |
NewerOlder