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.
@@ -1,3 +1,3 @@
1
- = concerned_states
1
+ # concerned_states
2
2
 
3
3
  A simple ActiveSupport::Concern for state related stuff I use frequently.
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "concerned_states"
6
- s.version = "0.1.3"
6
+ s.version = "0.1.4"
7
7
  s.authors = ["Richard Hart"]
8
8
  s.email = ["richard@ur-ban.com"]
9
9
  s.homepage = ""
@@ -2,19 +2,20 @@ module ConcernedStates
2
2
  module Stateable
3
3
  extend ActiveSupport::Concern
4
4
 
5
- PASSIVE = "passive"
6
- PENDING = "pending"
7
- DECLINED = "declined"
8
- APPROVED = "approved"
9
- ACTIVE = "active"
10
- FLAGGED = "flagged"
11
- SUSPENDED = "suspended"
12
- DELETED = "deleted"
13
- STARTED = "started"
14
- PAUSED = "paused"
15
- CANCELLED = "cancelled"
16
- COMPLETED = "completed"
17
- ERRORED = "errored"
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: 29
5
- prerelease:
4
+ hash: 19
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
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: 2011-11-12 00:00:00 +00:00
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.rdoc
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.6.2
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.