concerned_states 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/{README.rdoc → README.md} +1 -1
- data/concerned_states.gemspec +1 -1
- data/lib/concerned_states/stateable.rb +21 -13
- metadata +7 -7
data/{README.rdoc → README.md}
RENAMED
data/concerned_states.gemspec
CHANGED
@@ -2,19 +2,20 @@ module ConcernedStates
|
|
2
2
|
module Stateable
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
-
PASSIVE
|
6
|
-
PENDING
|
7
|
-
DECLINED
|
8
|
-
APPROVED
|
9
|
-
ACTIVE
|
10
|
-
FLAGGED
|
11
|
-
SUSPENDED =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
5
|
+
PASSIVE = "passive"
|
6
|
+
PENDING = "pending"
|
7
|
+
DECLINED = "declined"
|
8
|
+
APPROVED = "approved"
|
9
|
+
ACTIVE = "active"
|
10
|
+
FLAGGED = "flagged"
|
11
|
+
SUSPENDED = "suspended"
|
12
|
+
ARCHIVED = "archived"
|
13
|
+
DELETED = "deleted"
|
14
|
+
STARTED = "started"
|
15
|
+
PAUSED = "paused"
|
16
|
+
CANCELLED = "cancelled"
|
17
|
+
COMPLETED = "completed"
|
18
|
+
ERRORED = "errored"
|
18
19
|
|
19
20
|
included do
|
20
21
|
scope :passive,
|
@@ -38,6 +39,9 @@ module ConcernedStates
|
|
38
39
|
scope :suspended,
|
39
40
|
where(:state => SUSPENDED)
|
40
41
|
|
42
|
+
scope :archived,
|
43
|
+
where(:state => ARCHIVED)
|
44
|
+
|
41
45
|
scope :deleted,
|
42
46
|
where(:state => DELETED)
|
43
47
|
|
@@ -85,6 +89,10 @@ module ConcernedStates
|
|
85
89
|
def suspend!; update_attribute(:state, SUSPENDED); end
|
86
90
|
def suspended?; self.state == SUSPENDED; end
|
87
91
|
|
92
|
+
def archive; self.state = ARCHIVED; end
|
93
|
+
def archive!; update_attribute(:state, ARCHIVED); end
|
94
|
+
def archived?; self.state == ARCHIVED; end
|
95
|
+
|
88
96
|
def delete; self.state = DELETED; end
|
89
97
|
def delete!; update_attribute(:state, DELETED); end
|
90
98
|
def deleted?; self.state == DELETED; end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: concerned_states
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Hart
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-05-07 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -31,7 +31,7 @@ extra_rdoc_files: []
|
|
31
31
|
files:
|
32
32
|
- .gitignore
|
33
33
|
- Gemfile
|
34
|
-
- README.
|
34
|
+
- README.md
|
35
35
|
- Rakefile
|
36
36
|
- concerned_states.gemspec
|
37
37
|
- lib/concerned_states.rb
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
66
|
requirements: []
|
67
67
|
|
68
68
|
rubyforge_project: concerned_states
|
69
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.3.7
|
70
70
|
signing_key:
|
71
71
|
specification_version: 3
|
72
72
|
summary: A simple ActiveSupport::Concern for state related stuff I use frequently.
|