Class: PSQL::Column
- Inherits:
-
Object
- Object
- PSQL::Column
- Defined in:
- lib/psql/column.rb
Instance Attribute Summary collapse
-
#modifiers ⇒ Object
readonly
Returns the value of attribute modifiers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw_type ⇒ Object
readonly
Returns the value of attribute raw_type.
Instance Method Summary collapse
-
#initialize(name, raw_type, modifiers = nil) ⇒ Column
constructor
A new instance of Column.
- #type ⇒ Object
Constructor Details
#initialize(name, raw_type, modifiers = nil) ⇒ Column
Returns a new instance of Column.
6 7 8 |
# File 'lib/psql/column.rb', line 6 def initialize( name, raw_type, modifiers=nil ) @name, @raw_type, @modifiers = name, raw_type, modifiers end |
Instance Attribute Details
#modifiers ⇒ Object (readonly)
Returns the value of attribute modifiers.
9 10 11 |
# File 'lib/psql/column.rb', line 9 def modifiers @modifiers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/psql/column.rb', line 9 def name @name end |
#raw_type ⇒ Object (readonly)
Returns the value of attribute raw_type.
9 10 11 |
# File 'lib/psql/column.rb', line 9 def raw_type @raw_type end |
Instance Method Details
#type ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/psql/column.rb', line 13 def type case raw_type when 'integer' :integer when 'double precision' :float when 'boolean' :boolean when /^character varying/ :string when 'text' :text when 'date' :date when 'timestamp without time zone' :datetime end end |