Class: DBD4::Column
- Inherits:
-
Object
- Object
- DBD4::Column
- Defined in:
- lib/dbd4/dbd4_model_file.rb
Instance Attribute Summary collapse
-
#datatype ⇒ Object
readonly
Returns the value of attribute datatype.
-
#foreign_key ⇒ Object
readonly
Returns the value of attribute foreign_key.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#non_standard_name ⇒ Object
Returns the value of attribute non_standard_name.
-
#polymorphic ⇒ Object
Returns the value of attribute polymorphic.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
-
#table ⇒ Object
Returns the value of attribute table.
Instance Method Summary collapse
- #foreign_key? ⇒ Boolean
-
#initialize(column, table) ⇒ Column
constructor
A new instance of Column.
- #primary_key? ⇒ Boolean
- #resolve(allObjects) ⇒ Object
- #to_str ⇒ Object
- #validate(messages) ⇒ Object
Constructor Details
#initialize(column, table) ⇒ Column
Returns a new instance of Column.
220 221 222 223 224 225 226 227 228 229 |
# File 'lib/dbd4/dbd4_model_file.rb', line 220 def initialize(column, table) @id = column.attributes['ID'] @name= column.attributes['ColName'] @primary_key = column.attributes['PrimaryKey'] @foreign_key = column.attributes['IsForeignKey'] @datatype = Datatype.new(column, self) @table = table @non_standard_name = false @polymorphic = nil end |
Instance Attribute Details
#datatype ⇒ Object (readonly)
Returns the value of attribute datatype.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def datatype @datatype end |
#foreign_key ⇒ Object (readonly)
Returns the value of attribute foreign_key.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def foreign_key @foreign_key end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def name @name end |
#non_standard_name ⇒ Object
Returns the value of attribute non_standard_name.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def non_standard_name @non_standard_name end |
#polymorphic ⇒ Object
Returns the value of attribute polymorphic.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def polymorphic @polymorphic end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def primary_key @primary_key end |
#table ⇒ Object
Returns the value of attribute table.
209 210 211 |
# File 'lib/dbd4/dbd4_model_file.rb', line 209 def table @table end |
Instance Method Details
#foreign_key? ⇒ Boolean
216 217 218 |
# File 'lib/dbd4/dbd4_model_file.rb', line 216 def foreign_key? return @foreign_key != nil && @foreign_key == '1' end |
#primary_key? ⇒ Boolean
212 213 214 |
# File 'lib/dbd4/dbd4_model_file.rb', line 212 def primary_key? return @primary_key != nil && @primary_key == '1' end |
#resolve(allObjects) ⇒ Object
235 236 237 |
# File 'lib/dbd4/dbd4_model_file.rb', line 235 def resolve(allObjects) @datatype.resolve(allObjects) end |
#to_str ⇒ Object
239 240 241 |
# File 'lib/dbd4/dbd4_model_file.rb', line 239 def to_str "Column(id=#{id}, name=#{name}, pkey=#{primary_key?}, fkey=#{foreign_key?}, poly=#{polymorphic}, non_standard=#{non_standard_name}, " + datatype.to_str + ")" end |
#validate(messages) ⇒ Object
231 232 233 |
# File 'lib/dbd4/dbd4_model_file.rb', line 231 def validate() @datatype.validate() end |