Files
brew/Library/Homebrew/extend/module.rb
T
2015-08-03 13:22:35 +01:00

15 lines
277 B
Ruby

class Module
def attr_rw(*attrs)
file, line, = caller.first.split(":")
line = line.to_i
attrs.each do |attr|
module_eval <<-EOS, file, line
def #{attr}(val=nil)
val.nil? ? @#{attr} : @#{attr} = val
end
EOS
end
end
end