Sha256: 8fcfa55a2abb07da9b93c97a0b12dd18f2d8242d5fcdc086532c2e97fded1bfb
Contents?: true
Size: 437 Bytes
Versions: 11
Compression:
Stored size: 437 Bytes
Contents
# encoding: UTF-8 module BetterAttrAccessor def better_attr_reader(*names) names.each do |name| attr_reader name # leaves nil and false as is, returns true for everything else class_eval <<-RUBY def #{name}? @#{name} && true end RUBY end end def better_attr_accessor(*names) better_attr_reader *names names.each do |name| attr_writer name end end end
Version data entries
11 entries across 11 versions & 1 rubygems