Module: ConcernedStates::Stateable

Extended by:
ActiveSupport::Concern
Defined in:
lib/concerned_states/stateable.rb

Constant Summary collapse

PASSIVE =
"passive"
PENDING =
"pending"
DECLINED =
"declined"
APPROVED =
"approved"
INACTIVE =
"inactive"
ACTIVE =
"active"
FLAGGED =
"flagged"
SUSPENDED =
"suspended"
ARCHIVED =
"archived"
DELETED =
"deleted"
STARTED =
"started"
PAUSED =
"paused"
CANCELLED =
"cancelled"
COMPLETED =
"completed"
ERRORED =
"errored"

Instance Method Summary collapse

Instance Method Details

#activateObject



88
# File 'lib/concerned_states/stateable.rb', line 88

def activate; self.state = ACTIVE; end

#activate!Object



89
# File 'lib/concerned_states/stateable.rb', line 89

def activate!; update_attribute(:state, ACTIVE); end

#active?Boolean

Returns:

  • (Boolean)


90
# File 'lib/concerned_states/stateable.rb', line 90

def active?; self.state == ACTIVE; end

#approveObject



80
# File 'lib/concerned_states/stateable.rb', line 80

def approve; self.state = APPROVED; end

#approve!Object



81
# File 'lib/concerned_states/stateable.rb', line 81

def approve!; update_attribute(:state, APPROVE); end

#approved?Boolean

Returns:

  • (Boolean)


82
# File 'lib/concerned_states/stateable.rb', line 82

def approved?; self.state == APPROVED; end

#archiveObject



100
# File 'lib/concerned_states/stateable.rb', line 100

def archive; self.state = ARCHIVED; end

#archive!Object



101
# File 'lib/concerned_states/stateable.rb', line 101

def archive!; update_attribute(:state, ARCHIVED); end

#archived?Boolean

Returns:

  • (Boolean)


102
# File 'lib/concerned_states/stateable.rb', line 102

def archived?; self.state == ARCHIVED; end

#cancelObject



108
# File 'lib/concerned_states/stateable.rb', line 108

def cancel; self.state = CANCELLED; end

#cancel!Object



109
# File 'lib/concerned_states/stateable.rb', line 109

def cancel!; update_attribute(:state, CANCELLED); end

#canceled?Boolean

Returns:

  • (Boolean)


122
# File 'lib/concerned_states/stateable.rb', line 122

def canceled?; self.state == CANCELLED; end

#cancelled?Boolean

Returns:

  • (Boolean)


110
# File 'lib/concerned_states/stateable.rb', line 110

def cancelled?; self.state == CANCELLED; end

#completeObject



124
# File 'lib/concerned_states/stateable.rb', line 124

def complete; self.state = COMPLETED; end

#complete!Object



125
# File 'lib/concerned_states/stateable.rb', line 125

def complete!; update_attribute(:state, COMPLETED); end

#completed?Boolean

Returns:

  • (Boolean)


126
# File 'lib/concerned_states/stateable.rb', line 126

def completed?; self.state == COMPLETED; end

#declineObject



76
# File 'lib/concerned_states/stateable.rb', line 76

def decline; self.state = DECLINED; end

#decline!Object



77
# File 'lib/concerned_states/stateable.rb', line 77

def decline!; update_attribute(:state, DECLINED); end

#declined?Boolean

Returns:

  • (Boolean)


78
# File 'lib/concerned_states/stateable.rb', line 78

def declined?; self.state == DECLINED; end

#deleteObject



104
# File 'lib/concerned_states/stateable.rb', line 104

def delete; self.state = DELETED; end

#delete!Object



105
# File 'lib/concerned_states/stateable.rb', line 105

def delete!; update_attribute(:state, DELETED); end

#deleted?Boolean

Returns:

  • (Boolean)


106
# File 'lib/concerned_states/stateable.rb', line 106

def deleted?; self.state == DELETED; end

#errorObject



128
# File 'lib/concerned_states/stateable.rb', line 128

def error; self.state = ERRORED; end

#error!Object



129
# File 'lib/concerned_states/stateable.rb', line 129

def error!; update_attribute(:state, ERRORED); end

#errored?Boolean

Returns:

  • (Boolean)


130
# File 'lib/concerned_states/stateable.rb', line 130

def errored?; self.state == ERRORED; end

#flagObject



92
# File 'lib/concerned_states/stateable.rb', line 92

def flag; self.state = FLAGGED; end

#flag!Object



93
# File 'lib/concerned_states/stateable.rb', line 93

def flag!; update_attribute(:state, FLAGGED); end

#flagged?Boolean

Returns:

  • (Boolean)


94
# File 'lib/concerned_states/stateable.rb', line 94

def flagged?; self.state == FLAGGED; end

#inactivateObject



84
# File 'lib/concerned_states/stateable.rb', line 84

def inactivate; self.state = INACTIVE; end

#inactivate!Object



85
# File 'lib/concerned_states/stateable.rb', line 85

def inactivate!; update_attribute(:state, INACTIVE); end

#inactive?Boolean

Returns:

  • (Boolean)


86
# File 'lib/concerned_states/stateable.rb', line 86

def inactive?; self.state == INACTIVE; end

#passivateObject



68
# File 'lib/concerned_states/stateable.rb', line 68

def passivate; self.state = PASSIVE; end

#passivate!Object



69
# File 'lib/concerned_states/stateable.rb', line 69

def passivate!; update_attribute(:state, PASSIVE); end

#passive?Boolean

Returns:

  • (Boolean)


70
# File 'lib/concerned_states/stateable.rb', line 70

def passive?; self.state == PASSIVE; end

#pauseObject



116
# File 'lib/concerned_states/stateable.rb', line 116

def pause; self.state = PAUSED; end

#pause!Object



117
# File 'lib/concerned_states/stateable.rb', line 117

def pause!; update_attribute(:state, PAUSE); end

#paused?Boolean

Returns:

  • (Boolean)


118
# File 'lib/concerned_states/stateable.rb', line 118

def paused?; self.state == PAUSED; end

#pendinateObject



72
# File 'lib/concerned_states/stateable.rb', line 72

def pendinate; self.state = PENDING; end

#pendinate!Object



73
# File 'lib/concerned_states/stateable.rb', line 73

def pendinate!; update_attribute(:state, PENDING); end

#pending?Boolean

Returns:

  • (Boolean)


74
# File 'lib/concerned_states/stateable.rb', line 74

def pending?; self.state == PENDING; end

#startObject



112
# File 'lib/concerned_states/stateable.rb', line 112

def start; self.state = STARTED; end

#start!Object



113
# File 'lib/concerned_states/stateable.rb', line 113

def start!; update_attribute(:state, STARTED); end

#started?Boolean

Returns:

  • (Boolean)


114
# File 'lib/concerned_states/stateable.rb', line 114

def started?; self.state == STARTED; end

#suspendObject



96
# File 'lib/concerned_states/stateable.rb', line 96

def suspend; self.state = SUSPENDED; end

#suspend!Object



97
# File 'lib/concerned_states/stateable.rb', line 97

def suspend!; update_attribute(:state, SUSPENDED); end

#suspended?Boolean

Returns:

  • (Boolean)


98
# File 'lib/concerned_states/stateable.rb', line 98

def suspended?; self.state == SUSPENDED; end