Class: Array

Inherits:
Object
  • Object
show all
Includes:
Fieldable
Defined in:
lib/rq/arrayfields.rb

Overview

has added a class generator when the fields are known apriori.

Instance Attribute Summary

Attributes included from Fieldable

#fieldset

Class Method Summary collapse

Methods included from Fieldable

#fields, #fields=

Class Method Details

.fields(*fields) ⇒ Object Also known as: struct



288
289
290
291
292
293
294
295
296
297
298
# File 'lib/rq/arrayfields.rb', line 288

def fields *fields
  Class.new(self) do
    const_set :FIELDS, ArrayFields::FieldSet.new(fields.flatten)
    include ArrayFields
    def initialize *a, &b
      super
    ensure
      @fieldset = self.class.const_get :FIELDS
    end
  end
end