Class: RDBr::Metadata::PrimaryKey
- Inherits:
-
Data
- Object
- Data
- RDBr::Metadata::PrimaryKey
- Defined in:
- lib/rdbr/metadata/keys.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #composite? ⇒ Boolean
-
#initialize(columns:, name: nil) ⇒ PrimaryKey
constructor
A new instance of PrimaryKey.
Constructor Details
#initialize(columns:, name: nil) ⇒ PrimaryKey
Returns a new instance of PrimaryKey.
4 5 6 7 8 9 |
# File 'lib/rdbr/metadata/keys.rb', line 4 def initialize(columns:, name: nil) super( name: Values.optional_name(name, field: 'primary key name'), columns: Values.names(columns, field: 'primary key columns') ) end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns
3 4 5 |
# File 'lib/rdbr/metadata/keys.rb', line 3 def columns @columns end |
#name ⇒ Object (readonly)
Returns the value of attribute name
3 4 5 |
# File 'lib/rdbr/metadata/keys.rb', line 3 def name @name end |
Instance Method Details
#composite? ⇒ Boolean
11 12 13 |
# File 'lib/rdbr/metadata/keys.rb', line 11 def composite? columns.length > 1 end |