module HelloBlock::Utils

Public Instance Methods

mattr_accessor(*syms) click to toggle source
# File lib/helloblock/utils.rb, line 2
def mattr_accessor(*syms)
  syms.each do |sym|
    mattr_reader(sym)
    mattr_writer(sym)
  end
end
mattr_reader(sym) click to toggle source
# File lib/helloblock/utils.rb, line 9
def mattr_reader(sym)
  module_eval("def #{sym}; @#{sym}; end")
end
mattr_writer(sym) click to toggle source
# File lib/helloblock/utils.rb, line 13
def mattr_writer(sym)
  module_eval("def #{sym}=(obj); @#{sym} = obj; end")
  module_eval("@#{sym} = nil unless defined? @#{sym}")
end