Class: ActiveStash::CollectionProxy
- Inherits:
-
Object
- Object
- ActiveStash::CollectionProxy
- Extended by:
- Forwardable
- Defined in:
- lib/active_stash/collection_proxy.rb
Instance Method Summary collapse
- #create! ⇒ Object
- #drop! ⇒ Object
-
#info ⇒ Object
TODO: This is a stub.
-
#initialize(model) ⇒ CollectionProxy
constructor
A new instance of CollectionProxy.
- #schema ⇒ Object
Constructor Details
#initialize(model) ⇒ CollectionProxy
Returns a new instance of CollectionProxy.
9 10 11 |
# File 'lib/active_stash/collection_proxy.rb', line 9 def initialize(model) @model = model end |
Instance Method Details
#create! ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/active_stash/collection_proxy.rb', line 17 def create! client.create_collection(collection_name, schema) logger.info("Successfully created '#{collection_name}'") true rescue CipherStash::Client::Error::CollectionCreateFailure raise CollectionExistsError, name: collection_name end |
#drop! ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/active_stash/collection_proxy.rb', line 25 def drop! collection(skip_consistency_check: true).drop logger.info("Successfully dropped '#{collection_name}'") @collection = nil true rescue CipherStash::Client::Error::CollectionDeleteFailure raise NoCollectionError, "Collection '#{collection_name}' cannot be dropped because it doesn't exist" end |
#info ⇒ Object
TODO: This is a stub
35 36 37 |
# File 'lib/active_stash/collection_proxy.rb', line 35 def info collection end |
#schema ⇒ Object
13 14 15 |
# File 'lib/active_stash/collection_proxy.rb', line 13 def schema SchemaBuilder.new(@model).build end |