Class: Canery::Client
- Inherits:
-
Object
- Object
- Canery::Client
- Defined in:
- lib/canery/client.rb
Instance Method Summary collapse
- #delete_tub(name) ⇒ Object
- #has_tub?(name) ⇒ Boolean (also: #tub?)
-
#initialize(connection_uri = nil) ⇒ Client
constructor
A new instance of Client.
- #tub(name) ⇒ Object
- #tubs ⇒ Object
Constructor Details
Instance Method Details
#delete_tub(name) ⇒ Object
27 28 29 30 31 |
# File 'lib/canery/client.rb', line 27 def delete_tub(name) build_tub_name!(name) @tub_cache.delete(name) if @tub_cache[name] backend.call(:delete_namespace, name) end |
#has_tub?(name) ⇒ Boolean Also known as: tub?
33 34 35 |
# File 'lib/canery/client.rb', line 33 def has_tub?(name) backend.call(:namespace?, name) end |
#tub(name) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/canery/client.rb', line 16 def tub(name) build_tub_name!(name) create_tub(name) unless tub?(name) begin @tub_cache ||= {} @tub_cache[name] ||= Tub.new(backend, name) rescue raise Canery::CaneryError, "This tub does not exist! You must create it before you can use it." end end |
#tubs ⇒ Object
38 39 40 |
# File 'lib/canery/client.rb', line 38 def tubs backend.call(:namespaces) end |