Class: Spider::Model::Storage::Db::FieldExpression

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

Direct Known Subclasses

FixedExpression

Instance Attribute Summary collapse

Attributes inherited from Field

#attributes, #name, #table, #type

Instance Method Summary collapse

Methods inherited from Field

#==, #eql?, #hash, #inspect, #primary_key, #primary_key=

Constructor Details

#initialize(table, name, type, attributes = {}) ⇒ FieldExpression

Returns a new instance of FieldExpression.



274
275
276
277
278
279
280
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 274

def initialize(table, name, type, attributes={})
    @table = table
    @name = name.to_s
    @type = type
    @attributes = attributes
    @expression = attributes[:expression]
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



272
273
274
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 272

def expression
  @expression
end

Instance Method Details

#to_sObject



283
284
285
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 283

def to_s
    "#{@expression} AS #{@name}"
end