Class: CanTango::Engine

Inherits:
Object
  • Object
show all
Includes:
Helpers::Debug
Defined in:
lib/cantango/engine.rb

Instance Attribute Summary collapse

Attributes included from Helpers::Debug

#debug_writer, #do_debug

Instance Method Summary collapse

Methods included from Helpers::Debug

#debug, #debug?, included

Constructor Details

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

Returns a new instance of Engine.



9
10
11
# File 'lib/cantango/engine.rb', line 9

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

Instance Attribute Details

#abilityObject (readonly)

Returns the value of attribute ability.



5
6
7
# File 'lib/cantango/engine.rb', line 5

def ability
  @ability
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/cantango/engine.rb', line 5

def options
  @options
end

Instance Method Details

#engine_nameObject

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/cantango/engine.rb', line 17

def engine_name
  raise NotImplementedError
end

#execute!Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/cantango/engine.rb', line 13

def execute!
  raise NotImplementedError
end

#modesObject



25
26
27
# File 'lib/cantango/engine.rb', line 25

def modes
  @modes ||= options[:modes] || []
end

#valid_mode?(mode) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/cantango/engine.rb', line 21

def valid_mode? mode
  modes.include? mode.to_sym
end