Class: Kerbi::State::BaseBackend
- Inherits:
-
Object
- Object
- Kerbi::State::BaseBackend
- Defined in:
- lib/state/base_backend.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#is_working ⇒ TrueClass|FalseClass
readonly
Whether the last connection attempt succeeded or failed.
-
#release_name ⇒ String
readonly
Made available to states, as a convenience.
Class Method Summary collapse
Instance Method Summary collapse
- #delete ⇒ Object
- #delete_entry(entry) ⇒ Object
- #entries ⇒ Array<Kerbi::State::Entry>
- #entry_set ⇒ Kerbi::State::EntrySet
-
#initialize(options = {}) ⇒ BaseBackend
constructor
A new instance of BaseBackend.
- #prime ⇒ Object
- #resource_signature ⇒ Object
- #save ⇒ Object
- #working? ⇒ TrueClass|FalseClass
Constructor Details
#initialize(options = {}) ⇒ BaseBackend
Returns a new instance of BaseBackend.
15 16 |
# File 'lib/state/base_backend.rb', line 15 def initialize(={}) end |
Instance Attribute Details
#is_working ⇒ TrueClass|FalseClass (readonly)
Whether the last connection attempt succeeded or failed
13 14 15 |
# File 'lib/state/base_backend.rb', line 13 def is_working @is_working end |
#release_name ⇒ String (readonly)
Made available to states, as a convenience
8 9 10 |
# File 'lib/state/base_backend.rb', line 8 def release_name @release_name end |
Class Method Details
.type_signature ⇒ Object
70 71 72 |
# File 'lib/state/base_backend.rb', line 70 def self.type_signature raise NotImplementedError end |
Instance Method Details
#delete ⇒ Object
46 47 48 |
# File 'lib/state/base_backend.rb', line 46 def delete delete_resource end |
#delete_entry(entry) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/state/base_backend.rb', line 32 def delete_entry(entry) entries.reject! { |e| e.tag == entry.tag } save @_entry_set = nil @_resource = nil end |
#entries ⇒ Array<Kerbi::State::Entry>
27 28 29 |
# File 'lib/state/base_backend.rb', line 27 def entries entry_set.entries end |
#entry_set ⇒ Kerbi::State::EntrySet
19 20 21 22 23 24 |
# File 'lib/state/base_backend.rb', line 19 def entry_set @_entry_set ||= EntrySet.new( read_entries, release_name: release_name ) end |
#prime ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/state/base_backend.rb', line 54 def prime begin resource entries @is_working = true rescue @is_working = false end end |
#resource_signature ⇒ Object
50 51 52 |
# File 'lib/state/base_backend.rb', line 50 def resource_signature raise NotImplementedError end |
#save ⇒ Object
39 40 41 42 43 44 |
# File 'lib/state/base_backend.rb', line 39 def save entry_set.validate! update_resource @_entry_set = nil @_resource = nil end |
#working? ⇒ TrueClass|FalseClass
65 66 67 68 |
# File 'lib/state/base_backend.rb', line 65 def working? prime if @is_working.nil? @is_working end |