Sha256: e6d07c4fe5a81e7f979592b670c8b081886b9905323d314904c8512a8d4d13ca
Contents?: true
Size: 857 Bytes
Versions: 20
Compression:
Stored size: 857 Bytes
Contents
class Module private # As with alias_method, but alias both reader and writer. # # attr_accessor :x # self.x = 1 # alias_accessor :y, :x # y #=> 1 # self.y = 2 # x #=> 2 # def alias_accessor(*args) orig = args.last args = args - [orig] args.each do |name| alias_method(name, orig) alias_method("#{name}=", "#{orig}=") end end # As with alias_accessor, but just for the reader. # This is basically the same as alias_method. # def alias_reader(*args) orig = args.last args = args - [orig] args.each do |name| alias_method(name, orig) end end # As with alias_method but does the writer instead. # def alias_writer(*args) orig = args.last args = args - [orig] args.each do |name| alias_method("#{name}=", "#{orig}=") end end end
Version data entries
20 entries across 19 versions & 2 rubygems