Class: Cistern::Singular
- Inherits:
-
Object
- Object
- Cistern::Singular
- Extended by:
- Attributes::ClassMethods
- Includes:
- Attributes::InstanceMethods
- Defined in:
- lib/cistern/singular.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
- #fetch_attributes ⇒ Object
-
#initialize(options) ⇒ Singular
constructor
A new instance of Singular.
- #inspect ⇒ Object
- #reload ⇒ Object
Methods included from Attributes::ClassMethods
_load, aliases, attribute, attributes, identity, ignore_attributes, ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #attributes=, #dup, #identity, #identity=, #merge_attributes, #new_record?, #read_attribute, #requires, #requires_one, #write_attribute
Constructor Details
#initialize(options) ⇒ Singular
Returns a new instance of Singular.
15 16 17 18 |
# File 'lib/cistern/singular.rb', line 15 def initialize() merge_attributes() reload end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/cistern/singular.rb', line 5 def connection @connection end |
Instance Method Details
#fetch_attributes ⇒ Object
26 27 28 |
# File 'lib/cistern/singular.rb', line 26 def fetch_attributes raise NotImplementedError end |
#inspect ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/cistern/singular.rb', line 7 def inspect if Cistern.formatter Cistern.formatter.call(self) else "#<#{self.class}>" end end |
#reload ⇒ Object
20 21 22 23 24 |
# File 'lib/cistern/singular.rb', line 20 def reload if new_attributes = fetch_attributes merge_attributes(new_attributes) end end |