Parent

RBase::Columns::Column

Base class for all column types

Attributes

decimal[R]

Number of decimal places

name[R]

Column name

offset[R]

Column offset from the beginning of the record

size[R]

Column size in characters

Public Class Methods

column_for(type) click to toggle source

Returns column type class that correspond to given column type string

# File lib/rbase/columns.rb, line 17
def self.column_for(type)
  throw "Unknown column type '#{type}'" unless @@types.has_key?(type)
  @@types[type]
end
column_type(type) click to toggle source

Assigns column type string to current class

# File lib/rbase/columns.rb, line 11
def self.column_type(type)
  @type = type
  @@types[type] = self
end
new(name, options = {}) click to toggle source
# File lib/rbase/columns.rb, line 44
def initialize(name, options = {})
  options.merge({:name => name, :type => self.class.type}).each { |k, v| self.instance_variable_set("@#{k}", v) }
end
type() click to toggle source

Returns column type as 1 character string

# File lib/rbase/columns.rb, line 23
def self.type
  @type
end

Public Instance Methods

attach_to(table) click to toggle source
# File lib/rbase/columns.rb, line 49
def attach_to(table)
  @table = table
end
inspect() click to toggle source
# File lib/rbase/columns.rb, line 63
def inspect
  "#{name}(type=#{type}, size=#{size})"
end
pack(value) click to toggle source

Packs column value for storing it in XBase file.

# File lib/rbase/columns.rb, line 54
def pack(value)
  throw "Not implemented"
end
type() click to toggle source

Returns column type as 1 character string

# File lib/rbase/columns.rb, line 28
def type
  self.class.type
end
unpack(value) click to toggle source

Unpacks stored in XBase column data into appropriate Ruby form.

# File lib/rbase/columns.rb, line 59
def unpack(value)
  throw "Not implemented"
end

Protected Instance Methods

table() click to toggle source
# File lib/rbase/columns.rb, line 69
def table
  @table
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.