Class: Connect::Entry::Base
- Inherits:
-
Object
- Object
- Connect::Entry::Base
- Defined in:
- lib/connect/entries/base.rb
Overview
A base class for an entry in the values tables
Direct Known Subclasses
Class Attribute Summary collapse
-
.objects_table ⇒ Object
Returns the value of attribute objects_table.
-
.values_table ⇒ Object
Returns the value of attribute values_table.
Instance Attribute Summary collapse
-
#selector ⇒ Object
Returns the value of attribute selector.
-
#value ⇒ Object
Returns the value of attribute value.
-
#xref ⇒ Object
Returns the value of attribute xref.
Instance Method Summary collapse
- #add_reference(reference) ⇒ Object
-
#final ⇒ Hash
Translate the object for external representation.
-
#initialize(value, selector = nil, xref = nil) ⇒ Base
constructor
A new instance of Base.
- #merge!(entry) ⇒ Object
-
#to_ext ⇒ Hash
Translate the object for external representation.
Constructor Details
#initialize(value, selector = nil, xref = nil) ⇒ Base
Returns a new instance of Base.
20 21 22 23 24 |
# File 'lib/connect/entries/base.rb', line 20 def initialize(value, selector = nil, xref = nil) @xref = [xref].compact @value = value @selector = selector end |
Class Attribute Details
.objects_table ⇒ Object
Returns the value of attribute objects_table.
15 16 17 |
# File 'lib/connect/entries/base.rb', line 15 def objects_table @objects_table end |
.values_table ⇒ Object
Returns the value of attribute values_table.
15 16 17 |
# File 'lib/connect/entries/base.rb', line 15 def values_table @values_table end |
Instance Attribute Details
#selector ⇒ Object
Returns the value of attribute selector.
18 19 20 |
# File 'lib/connect/entries/base.rb', line 18 def selector @selector end |
#value ⇒ Object
Returns the value of attribute value.
18 19 20 |
# File 'lib/connect/entries/base.rb', line 18 def value @value end |
#xref ⇒ Object
Returns the value of attribute xref.
18 19 20 |
# File 'lib/connect/entries/base.rb', line 18 def xref @xref end |
Instance Method Details
#add_reference(reference) ⇒ Object
33 34 35 36 |
# File 'lib/connect/entries/base.rb', line 33 def add_reference(reference) @xref << reference @xref = @xref.flatten.compact end |
#final ⇒ Hash
Translate the object for external representation
53 54 55 56 57 |
# File 'lib/connect/entries/base.rb', line 53 def final result = self result = result.to_ext while result.respond_to?(:to_ext) result end |
#merge!(entry) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/connect/entries/base.rb', line 26 def merge!(entry) @xref << entry.xref @xref = @xref.flatten.compact @value = entry.value @selector = entry.selector end |
#to_ext ⇒ Hash
Translate the object for external representation
43 44 45 |
# File 'lib/connect/entries/base.rb', line 43 def to_ext fail ArgumentError, 'Internal error. to_ext must be implemented' end |