Class: SQLConstructor::QAttr

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(init_hash = nil) ⇒ QAttr



198
199
200
201
202
203
204
205
206
207
# File 'lib/sqlconstructor.rb', line 198

def initialize ( init_hash = nil )
    if init_hash.is_a? Hash
        @name           = init_hash[:name]
        @text           = init_hash[:text]
        @val            = init_hash[:val]
        @val_type       = init_hash[:val_type]
        @type           = init_hash[:type]
        @no_commas      = init_hash[:no_commas]
    end
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



195
196
197
# File 'lib/sqlconstructor.rb', line 195

def name
  @name
end

#no_commasObject (readonly)

Returns the value of attribute no_commas.



195
196
197
# File 'lib/sqlconstructor.rb', line 195

def no_commas
  @no_commas
end

#textObject (readonly)

Returns the value of attribute text.



195
196
197
# File 'lib/sqlconstructor.rb', line 195

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



195
196
197
# File 'lib/sqlconstructor.rb', line 195

def type
  @type
end

#valObject

Returns the value of attribute val.



196
197
198
# File 'lib/sqlconstructor.rb', line 196

def val
  @val
end

#val_typeObject (readonly)

Returns the value of attribute val_type.



195
196
197
# File 'lib/sqlconstructor.rb', line 195

def val_type
  @val_type
end

Instance Method Details

#to_sObject



210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/sqlconstructor.rb', line 210

def to_s
    if [ SQLValList, SQLAliasedList ].include? @val
        result = @val.to_s
    else 
        result = @text
        if @val
            val_arr = @val.is_a?( Array )  ? @val  : [ @val ]
            result += " " + val_arr.join( "," )
        end
    end
    return result
end