Module: Trole::Strategy::BaseOne

Defined in:
lib/trole/strategy.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Note:

the Trole::Api also includes the Troles::Common::Api

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

Parameters:

  • the (Class)

    role subject class for which to include the Role strategy (fx User Account)



19
20
21
# File 'lib/trole/strategy.rb', line 19

def self.included(base)
  base.send :include, Trole::Api
end

Instance Method Details

#storageClass

The storage strategy class

Returns:

  • (Class)

    a storage subclass



31
32
33
# File 'lib/trole/strategy.rb', line 31

def storage 
  Trole::Storage::BaseOne
end

#storeTroles::Storage

The storage to use

Returns:

  • (Troles::Storage)

    a storage subclass instance matching the needs of the strategy



25
26
27
# File 'lib/trole/strategy.rb', line 25

def store
  @store ||= storage.new self
end