Module: Redpear::Schema::ClassMethods

Defined in:
lib/redpear/schema.rb

Instance Method Summary collapse

Instance Method Details

#column(*args) ⇒ Object

Parameters:

  • args (multiple)

    the column definition. Please see Redpear::Schema::Column#initialize



12
13
14
15
16
# File 'lib/redpear/schema.rb', line 12

def column(*args)
  columns.store(Redpear::Schema::Column, self, *args).tap do |col|
    __define_attribute_accessors__(col)
  end
end

#columnsRedpear::Schema::Collection

Returns the columns of this model.

Returns:



7
8
9
# File 'lib/redpear/schema.rb', line 7

def columns
  @columns ||= Redpear::Schema::Collection.new
end

#index(*args) ⇒ Object

Parameters:

  • args (multiple)

    the index definition. Please see Redpear::Index#initialize



19
20
21
22
23
# File 'lib/redpear/schema.rb', line 19

def index(*args)
  columns.store(Redpear::Schema::Index, self, *args).tap do |col|
    __define_attribute_accessors__(col)
  end
end

#score(*args) ⇒ Object

Parameters:

  • args (multiple)

    the sorted index definition. Please see Redpear::ZIndex#initialize



26
27
28
29
30
# File 'lib/redpear/schema.rb', line 26

def score(*args)
  columns.store(Redpear::Schema::Score, self, *args).tap do |col|
    __define_attribute_accessors__(col)
  end
end