concerned_states 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/concerned_states.gemspec +1 -1
- data/lib/concerned_states/stateable.rb +8 -0
- metadata +3 -3
data/concerned_states.gemspec
CHANGED
@@ -6,6 +6,7 @@ module ConcernedStates
|
|
6
6
|
PENDING = "pending"
|
7
7
|
DECLINED = "declined"
|
8
8
|
APPROVED = "approved"
|
9
|
+
INACTIVE = "inactive"
|
9
10
|
ACTIVE = "active"
|
10
11
|
FLAGGED = "flagged"
|
11
12
|
SUSPENDED = "suspended"
|
@@ -30,6 +31,9 @@ module ConcernedStates
|
|
30
31
|
scope :approved,
|
31
32
|
where(:state => APPROVED)
|
32
33
|
|
34
|
+
scope :inactive,
|
35
|
+
where(:state => INACTIVE)
|
36
|
+
|
33
37
|
scope :active,
|
34
38
|
where(:state => ACTIVE)
|
35
39
|
|
@@ -77,6 +81,10 @@ module ConcernedStates
|
|
77
81
|
def approve!; update_attribute(:state, APPROVE); end
|
78
82
|
def approved?; self.state == APPROVED; end
|
79
83
|
|
84
|
+
def inactivate; self.state = INACTIVE; end
|
85
|
+
def inactivate!; update_attribute(:state, INACTIVE); end
|
86
|
+
def inactive?; self.state == INACTIVE; end
|
87
|
+
|
80
88
|
def activate; self.state = ACTIVE; end
|
81
89
|
def activate!; update_attribute(:state, ACTIVE); end
|
82
90
|
def active?; self.state == ACTIVE; 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:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 5
|
10
|
+
version: 0.1.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Hart
|