Class: PgGraph::Type::SimpleColumn
- Defined in:
- lib/pg_graph/type/type.rb
Overview
Note that this includes array columns (for now)
Instance Attribute Summary collapse
-
#ordinal ⇒ Object
readonly
Ordinal of column in the database.
Attributes inherited from Column
Attributes inherited from Field
Instance Method Summary collapse
-
#initialize(record_type, name, postgres_column, type, **opts) ⇒ SimpleColumn
constructor
A new instance of SimpleColumn.
-
#literal?(text) ⇒ Boolean
Return true if the ruby literal match the column type.
Methods inherited from Column
#dump, #dump_type, #generated?, #identity?, #kind?, #nullable?, #primary_key?, #readonly?, #reference?, #unique?
Methods included from TableObject
#record_type, #table, #table_type
Methods inherited from Field
#identifier, #schema_identifier
Methods inherited from Node
#dump, #guid, #identifier, #inspect, #inspect_inner, #schema_identifier
Constructor Details
#initialize(record_type, name, postgres_column, type, **opts) ⇒ SimpleColumn
Returns a new instance of SimpleColumn.
491 492 493 494 495 496 |
# File 'lib/pg_graph/type/type.rb', line 491 def initialize(record_type, name, postgres_column, type, **opts) constrain type, Type !type.is_a?(TableObject) or raise "Illegal field type: #{type.class}" @ordinal = opts.delete(:ordinal) super end |
Instance Attribute Details
#ordinal ⇒ Object (readonly)
Ordinal of column in the database
487 488 489 |
# File 'lib/pg_graph/type/type.rb', line 487 def ordinal @ordinal end |
Instance Method Details
#literal?(text) ⇒ Boolean
Return true if the ruby literal match the column type
499 |
# File 'lib/pg_graph/type/type.rb', line 499 def literal?(text) text.is_a?(ruby_class) end |