Module: AasmProgressable::ModelMixin

Extended by:
ActiveSupport::Concern
Defined in:
lib/aasm_progressable/model_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#aasm_state_orderObject

Instance gettor to return the state order for the model



12
13
14
# File 'lib/aasm_progressable/model_mixin.rb', line 12

def aasm_state_order
  self.class.get_aasm_state_order
end

#have_completed?(state) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/aasm_progressable/model_mixin.rb', line 16

def have_completed?(state)
  current_index, target_index = state_index(self.aasm.current_state, state)
  current_index > target_index
end

#have_not_completed?(state) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/aasm_progressable/model_mixin.rb', line 21

def have_not_completed?(state)
  not have_completed?(state)
end

#have_not_started?(state) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/aasm_progressable/model_mixin.rb', line 30

def have_not_started?(state)
  not have_started?(state)
end

#have_started?(state) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/aasm_progressable/model_mixin.rb', line 25

def have_started?(state)
  current_index, target_index = state_index(self.aasm.current_state, state)
  current_index >= target_index
end