Module: Glamazon::Accessors

Defined in:
lib/glamazon/accessors.rb

Instance Method Summary collapse

Instance Method Details

#attr_readonly(*attrs) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/glamazon/accessors.rb', line 3

def attr_readonly(*attrs)
  attrs.each do |attribute|
    define_method "#{attribute}=" do |obj|
      instance_variable_set :"@#{attribute}", obj unless instance_variable_get :"@#{attribute}"
    end
    attr_reader attribute
  end
end