Class: CanTango::Config::Ability

Inherits:
Object
  • Object
show all
Includes:
Factory, ClassExt, Singleton
Defined in:
lib/cantango/config/ability.rb,
lib/cantango/config/ability/modes.rb,
lib/cantango/config/ability/engine.rb,
lib/cantango/config/ability/modes/execution.rb

Defined Under Namespace

Classes: Engine, Modes

Instance Method Summary collapse

Methods included from Factory

#call_factory, #clear_factory!, #default_factory, #factory, #factory_build, #get_factory, #options, #options=, #type_options

Instance Method Details

#default_classObject



24
25
26
# File 'lib/cantango/config/ability.rb', line 24

def default_class
  @default_class ||= CanTango::Ability::Base
end

#default_executor_classObject



15
16
17
# File 'lib/cantango/config/ability.rb', line 15

def default_executor_class
  @default_executor_class ||= CanTango::Ability::Executor::Modal
end

#default_executor_class=(clazz) ⇒ Object

Raises:

  • (ArgumentError)


19
20
21
22
# File 'lib/cantango/config/ability.rb', line 19

def default_executor_class= clazz
  raise ArgumentError, "default must be a Class" if !is_class? clazz
  @default_executor_class = clazz
end

#engine(name) {|engine| ... } ⇒ Object

allow either block or direct access engine(:permission) do |permission| engine(:permission).config_path

Yields:



9
10
11
12
13
# File 'lib/cantango/config/ability/engine.rb', line 9

def engine name, &block
  engine = find_engine(name)
  yield engine if block
  engine
end

#factory_class_methodObject



28
29
30
# File 'lib/cantango/config/ability.rb', line 28

def factory_class_method
  :default_executor_class
end

#modesObject



11
12
13
# File 'lib/cantango/config/ability.rb', line 11

def modes
  Modes.instance
end