Class: PgGraph::Type::ArrayType
- Inherits:
-
Type
- Object
- HashTree::Set
- Node
- SchemaObject
- Type
- PgGraph::Type::ArrayType
- Defined in:
- lib/pg_graph/type/type.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_MAX_DIMENSIONS =
5
Instance Attribute Summary collapse
-
#dimensions ⇒ Object
readonly
Returns the value of attribute dimensions.
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
Instance Method Summary collapse
- #array? ⇒ Boolean
- #identifier ⇒ Object
-
#initialize(schema, name, element_type, dimensions = 1) ⇒ ArrayType
constructor
A new instance of ArrayType.
- #rank ⇒ Object
- #schema_identifier ⇒ Object
Methods inherited from Type
Methods inherited from Node
#dump, #guid, #inspect, #inspect_inner
Constructor Details
#initialize(schema, name, element_type, dimensions = 1) ⇒ ArrayType
Returns a new instance of ArrayType.
363 364 365 366 367 368 369 370 |
# File 'lib/pg_graph/type/type.rb', line 363 def initialize(schema, name, element_type, dimensions = 1) constrain element_type, Type self.class < TableObject or !element_type.is_a?(TableObject) or raise "Illegal element type" dimensions <= ArrayType.max_dimensions or raise Error, "Array dimension overflow" super(schema, name || PgGraph.inflector.type2array(element_type.name)) @element_type = element_type @dimensions = dimensions end |
Instance Attribute Details
#dimensions ⇒ Object (readonly)
Returns the value of attribute dimensions.
358 359 360 |
# File 'lib/pg_graph/type/type.rb', line 358 def dimensions @dimensions end |
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
357 358 359 |
# File 'lib/pg_graph/type/type.rb', line 357 def element_type @element_type end |
Instance Method Details
#array? ⇒ Boolean
361 |
# File 'lib/pg_graph/type/type.rb', line 361 def array?() true end |
#identifier ⇒ Object
372 373 374 |
# File 'lib/pg_graph/type/type.rb', line 372 def identifier "[#{element_type.identifier}]" end |
#rank ⇒ Object
360 |
# File 'lib/pg_graph/type/type.rb', line 360 def rank() 2 end |
#schema_identifier ⇒ Object
376 377 378 |
# File 'lib/pg_graph/type/type.rb', line 376 def schema_identifier "[#{element_type.schema_identifier}]" end |