Module: Moneta::Defaults::ClassMethods Private

Defined in:
lib/moneta/mixins.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#featuresArray<Symbol>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns features list

Returns:

  • (Array<Symbol>)

    list of features



62
63
64
# File 'lib/moneta/mixins.rb', line 62

def features
  @features ||= superclass.respond_to?(:features) ? superclass.features : [].freeze
end

#supports(*features) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Declares that this adapter supports the given feature.

Examples:

class MyAdapter
  include Moneta::Defaults
  supports :create
  def create(key, value, options = {})
    # implement create!
  end
end


76
77
78
# File 'lib/moneta/mixins.rb', line 76

def supports(*features)
  @features = (self.features + features).uniq.freeze
end