Class: SQLAliasedList
Overview
Class container - a list of SQLObjects with aliases
Instance Attribute Summary collapse
Attributes inherited from SQLObject
#alias, #inline, #name, #separator
Instance Method Summary
collapse
Methods inherited from SQLObject
#_name, #_string, #_string=, get
Constructor Details
Returns a new instance of SQLAliasedList.
195
196
197
|
# File 'lib/sqlobject.rb', line 195
def initialize ( *list )
@list = _getList *list
end
|
Instance Attribute Details
#no_commas=(value) ⇒ Object
Sets the attribute no_commas
193
194
195
|
# File 'lib/sqlobject.rb', line 193
def no_commas=(value)
@no_commas = value
end
|
Instance Method Details
#<<(*list) ⇒ Object
199
200
201
202
|
# File 'lib/sqlobject.rb', line 199
def << ( *list )
@list += _getList *list
return self
end
|
#[](i) ⇒ Object
220
221
222
|
# File 'lib/sqlobject.rb', line 220
def [] (i)
@list[i]
end
|
#delete_if(&block) ⇒ Object
216
217
218
|
# File 'lib/sqlobject.rb', line 216
def delete_if ( &block )
@list.delete_if &block
end
|
#each(&block) ⇒ Object
212
213
214
|
# File 'lib/sqlobject.rb', line 212
def each ( &block )
@list.each &block
end
|
#each_with_index(&block) ⇒ Object
232
233
234
|
# File 'lib/sqlobject.rb', line 232
def each_with_index ( &block )
@list.each_with_index &block
end
|
#find(&block) ⇒ Object
224
225
226
|
# File 'lib/sqlobject.rb', line 224
def find ( &block )
@list.find &block
end
|
#length ⇒ Object
208
209
210
|
# File 'lib/sqlobject.rb', line 208
def length
@list.length
end
|
#push(*list) ⇒ Object
204
205
206
|
# File 'lib/sqlobject.rb', line 204
def push ( *list )
@list += _getList( *list )
end
|
#select(&block) ⇒ Object
228
229
230
|
# File 'lib/sqlobject.rb', line 228
def select ( &block )
@list.each &block
end
|
#to_s ⇒ Object
236
237
238
239
240
241
|
# File 'lib/sqlobject.rb', line 236
def to_s
return @string if @string
arr = @list.map { |obj| obj.to_s + ( obj.alias ? " " + obj.alias.to_s : "" ) }
list_separator = @no_commas ? "" : ","
@string = arr.join list_separator
end
|