microscope 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/microscope.rb +10 -14
- data/lib/microscope/version.rb +1 -1
- data/spec/microscope_spec.rb +4 -4
- metadata +17 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bbe546a0992badf5f49cdc16de08a22bc41d8c7b
|
4
|
+
data.tar.gz: e384811bc6c78629902d024d4ad5b1ba35b5de91
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b935b723edbfb69c5cc4f971ec09f2a4cf92fcaedc9b7b075b4323e77502cfa24090954a12a2e058278795e5829b7e34ebc0e033d3b9839f6f9a211b544eb929
|
7
|
+
data.tar.gz: 07087ccd590dd1e350bb57d52358d8e159d29ee1b5ac5cf31bc6b16fd391587bc655f971df64ea1564a54a76ac85100ac30848c38228e13d75e187b1be73037b
|
data/lib/microscope.rb
CHANGED
@@ -12,22 +12,18 @@ require "microscope/instance_method"
|
|
12
12
|
require "microscope/instance_method/datetime_instance_method"
|
13
13
|
require "microscope/instance_method/date_instance_method"
|
14
14
|
|
15
|
-
|
16
|
-
def self.
|
17
|
-
|
18
|
-
def self.acts_as_microscope(options = {})
|
19
|
-
except = options[:except] || []
|
20
|
-
model_columns = columns.dup.reject { |c| except.include?(c.name.to_sym) }
|
15
|
+
class ActiveRecord::Base
|
16
|
+
def self.acts_as_microscope(options = {})
|
17
|
+
return unless table_exists?
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
19
|
+
except = options[:except] || []
|
20
|
+
model_columns = columns.dup.reject { |c| except.include?(c.name.to_sym) }
|
25
21
|
|
26
|
-
|
27
|
-
|
28
|
-
end
|
22
|
+
if only = options[:only]
|
23
|
+
model_columns = model_columns.select { |c| only.include?(c.name.to_sym) }
|
29
24
|
end
|
25
|
+
|
26
|
+
Microscope::Scope.inject_scopes(self, model_columns, options)
|
27
|
+
Microscope::InstanceMethod.inject_instance_methods(self, model_columns, options)
|
30
28
|
end
|
31
29
|
end
|
32
|
-
|
33
|
-
ActiveRecord::Base.class_eval(&Microscope.inject_into_active_record)
|
data/lib/microscope/version.rb
CHANGED
data/spec/microscope_spec.rb
CHANGED
@@ -13,12 +13,12 @@ describe Microscope do
|
|
13
13
|
t.boolean :moderator, default: false
|
14
14
|
|
15
15
|
# DateTime
|
16
|
-
t.datetime :published_at, default:
|
17
|
-
t.datetime :removed_at, default:
|
16
|
+
t.datetime :published_at, default: nil
|
17
|
+
t.datetime :removed_at, default: nil
|
18
18
|
|
19
19
|
# Date
|
20
|
-
t.date :started_on, default:
|
21
|
-
t.date :ended_on, default:
|
20
|
+
t.date :started_on, default: nil
|
21
|
+
t.date :ended_on, default: nil
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Simon Prévost
|
@@ -10,44 +9,39 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-09-05 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: activesupport
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: 3.0.0
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: 3.0.0
|
31
28
|
- !ruby/object:Gem::Dependency
|
32
29
|
name: activerecord
|
33
30
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
31
|
requirements:
|
36
|
-
- -
|
32
|
+
- - '>='
|
37
33
|
- !ruby/object:Gem::Version
|
38
34
|
version: 3.0.0
|
39
35
|
type: :runtime
|
40
36
|
prerelease: false
|
41
37
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
38
|
requirements:
|
44
|
-
- -
|
39
|
+
- - '>='
|
45
40
|
- !ruby/object:Gem::Version
|
46
41
|
version: 3.0.0
|
47
42
|
- !ruby/object:Gem::Dependency
|
48
43
|
name: bundler
|
49
44
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
45
|
requirements:
|
52
46
|
- - ~>
|
53
47
|
- !ruby/object:Gem::Version
|
@@ -55,7 +49,6 @@ dependencies:
|
|
55
49
|
type: :development
|
56
50
|
prerelease: false
|
57
51
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
52
|
requirements:
|
60
53
|
- - ~>
|
61
54
|
- !ruby/object:Gem::Version
|
@@ -63,49 +56,43 @@ dependencies:
|
|
63
56
|
- !ruby/object:Gem::Dependency
|
64
57
|
name: rake
|
65
58
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
59
|
requirements:
|
68
|
-
- -
|
60
|
+
- - '>='
|
69
61
|
- !ruby/object:Gem::Version
|
70
62
|
version: '0'
|
71
63
|
type: :development
|
72
64
|
prerelease: false
|
73
65
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
66
|
requirements:
|
76
|
-
- -
|
67
|
+
- - '>='
|
77
68
|
- !ruby/object:Gem::Version
|
78
69
|
version: '0'
|
79
70
|
- !ruby/object:Gem::Dependency
|
80
71
|
name: rspec
|
81
72
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
73
|
requirements:
|
84
|
-
- -
|
74
|
+
- - '>='
|
85
75
|
- !ruby/object:Gem::Version
|
86
76
|
version: '0'
|
87
77
|
type: :development
|
88
78
|
prerelease: false
|
89
79
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
80
|
requirements:
|
92
|
-
- -
|
81
|
+
- - '>='
|
93
82
|
- !ruby/object:Gem::Version
|
94
83
|
version: '0'
|
95
84
|
- !ruby/object:Gem::Dependency
|
96
85
|
name: sqlite3
|
97
86
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
87
|
requirements:
|
100
|
-
- -
|
88
|
+
- - '>='
|
101
89
|
- !ruby/object:Gem::Version
|
102
90
|
version: '0'
|
103
91
|
type: :development
|
104
92
|
prerelease: false
|
105
93
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
94
|
requirements:
|
108
|
-
- -
|
95
|
+
- - '>='
|
109
96
|
- !ruby/object:Gem::Version
|
110
97
|
version: '0'
|
111
98
|
description: Microscope adds useful scopes targeting ActiveRecord boolean and datetime
|
@@ -148,33 +135,26 @@ files:
|
|
148
135
|
homepage: https://github.com/mirego/microscope
|
149
136
|
licenses:
|
150
137
|
- BSD 3-Clause
|
138
|
+
metadata: {}
|
151
139
|
post_install_message:
|
152
140
|
rdoc_options: []
|
153
141
|
require_paths:
|
154
142
|
- lib
|
155
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
-
none: false
|
157
144
|
requirements:
|
158
|
-
- -
|
145
|
+
- - '>='
|
159
146
|
- !ruby/object:Gem::Version
|
160
147
|
version: '0'
|
161
|
-
segments:
|
162
|
-
- 0
|
163
|
-
hash: 3433673012719073524
|
164
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
|
-
none: false
|
166
149
|
requirements:
|
167
|
-
- -
|
150
|
+
- - '>='
|
168
151
|
- !ruby/object:Gem::Version
|
169
152
|
version: '0'
|
170
|
-
segments:
|
171
|
-
- 0
|
172
|
-
hash: 3433673012719073524
|
173
153
|
requirements: []
|
174
154
|
rubyforge_project:
|
175
|
-
rubygems_version:
|
155
|
+
rubygems_version: 2.0.2
|
176
156
|
signing_key:
|
177
|
-
specification_version:
|
157
|
+
specification_version: 4
|
178
158
|
summary: Microscope adds useful scopes targeting ActiveRecord boolean and datetime
|
179
159
|
fields.
|
180
160
|
test_files:
|