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
module ExtraMethods | |
def def_foo | |
# b = binding | |
# NOTE: The binding acquired here always belongs to ExtraMethods, NOT to | |
# SomeClass, which is what I actually want. | |
end | |
module_function :def_foo | |
end |
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
vals = { foo: 1, bar: 2, baz: 3 } | |
# Good! | |
puts vals.map { |k, v| "#{k}=#{v}" }.join ' ' | |
# Bad! | |
puts vals.map do |k, v| | |
"#{k}=#{v}" | |
end.join ' ' |