Class: Lode::Client
- Inherits:
-
Object
- Object
- Lode::Client
- Extended by:
- Forwardable
- Defined in:
- lib/lode/client.rb
Overview
Provides an enhanced PStore-based client.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#store ⇒ Object
readonly
Returns the value of attribute store.
Instance Method Summary collapse
- #commit(key) ⇒ Object
-
#initialize(path, configuration: Configuration.new) {|configuration| ... } ⇒ Client
constructor
A new instance of Client.
- #read(key) ⇒ Object
- #write(key) ⇒ Object
Constructor Details
#initialize(path, configuration: Configuration.new) {|configuration| ... } ⇒ Client
Returns a new instance of Client.
17 18 19 20 21 22 23 |
# File 'lib/lode/client.rb', line 17 def initialize path, configuration: Configuration.new yield configuration if block_given? @path = Pathname(path).make_ancestors @configuration = configuration @store = configuration.store_for path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/lode/client.rb', line 13 def path @path end |
#store ⇒ Object (readonly)
Returns the value of attribute store.
13 14 15 |
# File 'lib/lode/client.rb', line 13 def store @store end |
Instance Method Details
#commit(key) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/lode/client.rb', line 29 def commit(key, &) warn "`#{self.class}##{__method__}` is deprecated, use `#write` instead.", category: :deprecated write(key, &) end |
#read(key) ⇒ Object
25 |
# File 'lib/lode/client.rb', line 25 def read(key, &) = transact(__method__, key, &) |
#write(key) ⇒ Object
27 |
# File 'lib/lode/client.rb', line 27 def write(key, &) = transact(:commit, key, &) |