Sha256: c06c8230027f1a655ca4a499a4676374f8d31399969e5ced88a708b613ade04d

Contents?: true

Size: 1010 Bytes

Versions: 5

Compression:

Stored size: 1010 Bytes

Contents

#
# @author Kristian Mandrup
#
# Base module for Single role strategies
#
module Trole::Strategy
  module BaseOne
    #
    # a Many role strategy is included by a role subject (fx a UserAccount class) 
    # a Many role strategy should always include BaseMany
    # when BaseMany is included, it ensures that the complete 
    # Trole Api is also included into the role subject                                              
    #
    # @note the Trole::Api also includes the Troles::Common::Api
    #
    # @param [Class] the role subject class for which to include the Role strategy (fx User Account)
    #
    #
    def self.included(base)
      base.send :include, Trole::Api
    end      

    # The storage to use
    # @return [Troles::Storage] a storage subclass instance matching the needs of the strategy
    def store
      @store ||= storage.new self
    end

    # The storage strategy class
    # @return [Class] a storage subclass
    def storage 
      Trole::Storage::BaseOne
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
troles-0.6.1 lib/trole/strategy.rb
troles-0.6.0 lib/trole/strategy.rb
troles-0.5.2 lib/trole/strategy.rb
troles-0.5.1 lib/trole/strategy.rb
troles-0.5.0 lib/trole/strategy.rb