Module: Alchemist::Record::ClassMethods

Defined in:
lib/alchemist-server/record.rb

Instance Method Summary collapse

Instance Method Details

#attr_namesObject



31
32
33
# File 'lib/alchemist-server/record.rb', line 31

def attr_names
  @attr_names ||= []
end

#attr_names=(attrs) ⇒ Object



35
36
37
# File 'lib/alchemist-server/record.rb', line 35

def attr_names=(attrs)
  @attr_names = attrs
end

#record_attr(*attrs) ⇒ Object



39
40
41
42
43
44
45
46
47
48
# File 'lib/alchemist-server/record.rb', line 39

def record_attr(*attrs)
  attrs.each do |attr|
    class_eval %{
      def #{attr}
        read :#{attr}
      end
    }
  end
  self.attr_names += attrs
end