Class: Spider::Model::Storage::Db::FieldFunction

Inherits:
Object
  • Object
show all
Defined in:
lib/spiderfw/model/storage/db/db_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression, table, joins) ⇒ FieldFunction

Returns a new instance of FieldFunction.



299
300
301
302
303
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 299

def initialize(expression, table, joins)
    @expression = expression
    @table = table
    @joins = joins
end

Instance Attribute Details

#asObject

Returns the value of attribute as.



298
299
300
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 298

def as
  @as
end

#expressionObject (readonly)

Returns the value of attribute expression.



297
298
299
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 297

def expression
  @expression
end

#joinsObject (readonly)

Returns the value of attribute joins.



297
298
299
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 297

def joins
  @joins
end

#tableObject (readonly)

Returns the value of attribute table.



297
298
299
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 297

def table
  @table
end

Instance Method Details

#aggregate=(val) ⇒ Object



305
306
307
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 305

def aggregate=(val)
    @aggregate = val
end

#aggregate?Boolean

Returns:

  • (Boolean)


309
310
311
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 309

def aggregate?
    !!@aggregate
end

#to_sObject



313
314
315
316
317
318
319
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 313

def to_s
    if @as
        "#{@expression} AS #{@as}"
    else
        @expression
    end
end