Class: Record

Inherits:
Object
  • Object
show all
Defined in:
lib/records/record.rb

Direct Known Subclasses

Base

Defined Under Namespace

Classes: Base, Field, Type

Constant Summary collapse

Types =

note Types is an alias for Type

Type

Class Method Summary collapse

Class Method Details

.build_class(class_name, **attributes) ⇒ Object Also known as: new



119
120
121
122
123
124
125
126
# File 'lib/records/record.rb', line 119

def self.build_class( class_name, **attributes )
  klass = Class.new( Base )
  attributes.each do |key, type|
     klass.field( key, type )
  end

  Type.const_set( class_name, klass )   ## returns klass (plus sets global constant class name)
end