Class: PgGraph::Data::Field
- Inherits:
-
DatabaseObject
- Object
- Node
- DatabaseObject
- PgGraph::Data::Field
- Defined in:
- lib/pg_graph/data/data.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#record ⇒ Object
readonly
Record of field.
Attributes inherited from Node
Instance Method Summary collapse
-
#database ⇒ Object
Redefine DatabaseObject#database.
-
#guid ⇒ Object
Redefine #uid.
-
#initialize(record, name, **opts) ⇒ Field
constructor
A new instance of Field.
-
#name ⇒ Object
Redefine #name to return a Symbol.
- #to_h ⇒ Object
-
#uid ⇒ Object
Redefine #uid.
Methods inherited from DatabaseObject
Methods inherited from Node
#data, #inspect, #object, #to_yaml, #value, #value_type
Constructor Details
#initialize(record, name, **opts) ⇒ Field
Returns a new instance of Field.
458 459 460 461 462 463 |
# File 'lib/pg_graph/data/data.rb', line 458 def initialize(record, name, **opts) constrain record, Record constrain name, String, Symbol @record = record # has to go before super super(record.type[name.to_s], **opts) end |
Instance Attribute Details
#record ⇒ Object (readonly)
Record of field
456 457 458 |
# File 'lib/pg_graph/data/data.rb', line 456 def record @record end |
Instance Method Details
#database ⇒ Object
Redefine DatabaseObject#database
453 |
# File 'lib/pg_graph/data/data.rb', line 453 def database() record.database end |
#guid ⇒ Object
Redefine #uid
447 |
# File 'lib/pg_graph/data/data.rb', line 447 def guid() "#{record.guid}.#{name}" end |
#name ⇒ Object
Redefine #name to return a Symbol
450 |
# File 'lib/pg_graph/data/data.rb', line 450 def name() super.to_sym end |
#to_h ⇒ Object
465 |
# File 'lib/pg_graph/data/data.rb', line 465 def to_h() { name: value } end |
#uid ⇒ Object
Redefine #uid
444 |
# File 'lib/pg_graph/data/data.rb', line 444 def uid() "#{record.uid}.#{name}" end |