active_scope 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ lib/active_scope.rb
File without changes
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('active_scope','0.1.0') do |a|
6
+ a.description = "Automatic active or inactive scopes"
7
+ a.url = "http://github.com/citizens/active_scope"
8
+ a.author = "Dylan Montgomery"
9
+ a.ignore_pattern = ["tmp/*", "script/*"]
10
+ a.development_dependencies = []
11
+ end
12
+
13
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each{ |ext| load ext} # Load task files
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "active_scope"
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Dylan Montgomery"]
9
+ s.date = "2012-03-17"
10
+ s.description = "Automatic active or inactive scopes"
11
+ s.email = ""
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/active_scope.rb"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "lib/active_scope.rb", "active_scope.gemspec"]
14
+ s.homepage = "http://github.com/citizens/active_scope"
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Active_scope", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = "active_scope"
18
+ s.rubygems_version = "1.8.19"
19
+ s.summary = "Automatic active or inactive scopes"
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module ActiveScope
2
+ def self.include(base)
3
+ base.extend ClassMethods
4
+ end
5
+
6
+ module ClassMethods
7
+
8
+ def self.active
9
+ where(:active=>true)
10
+ end
11
+
12
+ def self.inactive
13
+ where('active IN (?)', [false,nil])
14
+ end
15
+
16
+ def activate
17
+ update_attribute(:active,true)
18
+ end
19
+
20
+ def deactive
21
+ update_attribute(:active,false)
22
+ end
23
+
24
+ end
25
+ end
26
+
27
+ class ActiveRecord::Base
28
+ include ActiveScope
29
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_scope
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Dylan Montgomery
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-03-17 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: Automatic active or inactive scopes
17
+ email: ""
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.rdoc
24
+ - lib/active_scope.rb
25
+ files:
26
+ - Manifest
27
+ - README.rdoc
28
+ - Rakefile
29
+ - lib/active_scope.rb
30
+ - active_scope.gemspec
31
+ homepage: http://github.com/citizens/active_scope
32
+ licenses: []
33
+
34
+ post_install_message:
35
+ rdoc_options:
36
+ - --line-numbers
37
+ - --inline-source
38
+ - --title
39
+ - Active_scope
40
+ - --main
41
+ - README.rdoc
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ none: false
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "1.2"
56
+ requirements: []
57
+
58
+ rubyforge_project: active_scope
59
+ rubygems_version: 1.8.19
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: Automatic active or inactive scopes
63
+ test_files: []
64
+