In Files

Parent

Files

SQLObject

Main class for all objects. All other entities should inherit this class.

Attributes

alias[RW]
inline[RW]
name[RW]
separator[RW]

Public Class Methods

get( *list ) click to toggle source

Convert values to the corresponding internal data types

# File lib/sqlobject.rb, line 52
def self.get ( *list )
    list.map! do |expr|
        if expr.is_a? SQLObject
             # inline queries go in parens:
            if expr.class == SQLConstructor || expr.is_a?( SQLConstructor::GenericQuery )
                expr.inline = true
            end
            expr
        elsif expr.is_a? Array or expr.is_a? Range
            SQLValList.new *expr.to_a
        elsif expr.is_a? Hash
            SQLAliasedList.new expr
        elsif expr.is_a? Symbol
            SQLColumn.new( expr )
        else
            SQLValue.new( expr )
        end
    end

     # Return array or scalar, depending on the number of function arguments
    list.length == 1  ?  list[0]  :  list
end
new() click to toggle source

Do we really need a constructor here?

# File lib/sqlobject.rb, line 12
def initialize
    @string = nil
    @alias  = nil
    @name   = nil
    @inline = nil
end

Public Instance Methods

_name( name ) click to toggle source

Set object’s name for further named processing

# File lib/sqlobject.rb, line 22
def _name ( name )
    @name = name.to_s
    return self
end
_string() click to toggle source

attr_reader for @string, actually an alias to to_s().

# File lib/sqlobject.rb, line 38
def _string
    to_s
end
_string=( val ) click to toggle source

attr_writer for @string

# File lib/sqlobject.rb, line 45
def _string= ( val )
    @string = val
end
to_s() click to toggle source

Store string representation in @string after the first call

# File lib/sqlobject.rb, line 30
def to_s
    return @string  if @string
    @string = self.to_s
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.