Class: CanTango::Builder::Permit::Base

Inherits:
Object
  • Object
show all
Extended by:
ClassMethods
Includes:
Helpers::Debug
Defined in:
lib/cantango/permits_ext/builder/permit/base.rb

Defined Under Namespace

Modules: ClassMethods Classes: CreatePermitError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Permit::Helper::Naming

#account_name, #permit_name

Constructor Details

#initialize(ability, options = {}) ⇒ Base

creates the factory for the ability note that the ability contains the roles and role groups of the user (or account)

Parameters:

  • the (Permits::Ability)

    ability



16
17
18
# File 'lib/cantango/permits_ext/builder/permit/base.rb', line 16

def initialize ability, options = {}
  @ability, @options = [ability, options]
end

Instance Attribute Details

#abilityObject

Returns the value of attribute ability.



8
9
10
# File 'lib/cantango/permits_ext/builder/permit/base.rb', line 8

def ability
  @ability
end

#optionsObject

Returns the value of attribute options.



8
9
10
# File 'lib/cantango/permits_ext/builder/permit/base.rb', line 8

def options
  @options
end

Instance Method Details

#buildArray<Permit::Base>

builds a list of Permits for each role of the current ability user (or account)

Returns:

  • (Array<Permit::Base>)

    the role permits built for this ability



31
32
33
34
# File 'lib/cantango/permits_ext/builder/permit/base.rb', line 31

def build
  debug debug_msg
  permits
end

#permit_typeObject



25
26
27
# File 'lib/cantango/permits_ext/builder/permit/base.rb', line 25

def permit_type
  self.class.permit_name
end