Class: FluidFeatures::Persistence::Features
- Defined in:
- lib/fluidfeatures/persistence/features.rb
Instance Attribute Summary
Attributes inherited from Storage
#dir, #file_name, #logger, #store
Class Method Summary collapse
Instance Method Summary collapse
- #list ⇒ Object
-
#list_unknown ⇒ Object
TODO: remove.
- #replace(features) ⇒ Object
- #replace_unknown(features) ⇒ Object
Methods inherited from Storage
#file_size, #initialize, #path
Constructor Details
This class inherits a constructor from FluidFeatures::Persistence::Storage
Class Method Details
.create(config, logger = nil) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/fluidfeatures/persistence/features.rb', line 5 def self.create(config, logger=nil) if config && config["dir"] && config["enable"] new(config, logger) else NullFeatures.new end end |
Instance Method Details
#list ⇒ Object
13 14 15 16 17 18 |
# File 'lib/fluidfeatures/persistence/features.rb', line 13 def list store.transaction(true) do return nil unless store && store["features"] store["features"] end end |
#list_unknown ⇒ Object
TODO: remove. we do not care about persisting these
28 29 30 31 32 33 |
# File 'lib/fluidfeatures/persistence/features.rb', line 28 def list_unknown store.transaction(true) do return {} unless store && store["unknown_features"] store["unknown_features"] end end |
#replace(features) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/fluidfeatures/persistence/features.rb', line 20 def replace(features) transaction do store["features"] = features !!store["features"] end end |
#replace_unknown(features) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/fluidfeatures/persistence/features.rb', line 35 def replace_unknown(features) transaction do store["unknown_features"] = features !!store["unknown_features"] end end |