Class: Spider::Model::Storage::Db::Field
- Inherits:
-
Object
- Object
- Spider::Model::Storage::Db::Field
show all
- Defined in:
- lib/spiderfw/model/storage/db/db_schema.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(table, name, type, attributes = {}) ⇒ Field
Returns a new instance of Field.
210
211
212
213
214
215
216
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 210
def initialize(table, name, type, attributes={})
@table = table
@name = name.to_s
@type = type
@attributes = attributes
@table.add_field(self)
end
|
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
208
209
210
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 208
def attributes
@attributes
end
|
Returns the value of attribute name.
207
208
209
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 207
def name
@name
end
|
Returns the value of attribute table.
206
207
208
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 206
def table
@table
end
|
Returns the value of attribute type.
207
208
209
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 207
def type
@type
end
|
Instance Method Details
#==(other) ⇒ Object
237
238
239
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 237
def ==(other)
@table == other.table && @name == other.name
end
|
#eql?(other) ⇒ Boolean
242
243
244
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 242
def eql?(other)
self == other
end
|
246
247
248
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 246
def hash
to_s.hash
end
|
233
234
235
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 233
def inspect
"#<#{self.class.name}:#{self.object_id} @name=\"#{@name}\", @table=#<Spider::Model::Storage::Db::Table:#{@table.object_id} #{@table.name}> >"
end
|
#primary_key ⇒ Object
Also known as:
primary_key?
219
220
221
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 219
def primary_key
@attributes[:primary_key]
end
|
#primary_key=(val) ⇒ Object
224
225
226
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 224
def primary_key=(val)
@attributes[:primary_key] = true
end
|
229
230
231
|
# File 'lib/spiderfw/model/storage/db/db_schema.rb', line 229
def to_s
"#{@table.name}.#{@name}"
end
|