super_map 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Rakefile +1 -1
- data/lib/super_mapped_attr.rb +9 -0
- metadata +24 -47
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1fdf0b5f7e42c1c0e22dc13f42e8aac5a87040c
|
4
|
+
data.tar.gz: 1e7a8091e0c6195b689eca20aff0ac6be8305d67
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7e94162f41263fe9d598315ee58f93ce20df918be748ace1aa5993aade926a81a74045979c47603715020f0f5a1449a3766e316a48c68e761eedbb31023cf7ba
|
7
|
+
data.tar.gz: 7e03e5f16aabe61a50221eba1a59d72eb637c5306acf66fccec59d7d3264a44b473661ca88438e1dda886e225d111769e7a08b91d919ced61ef1fb117e477d39
|
data/Rakefile
CHANGED
@@ -14,7 +14,7 @@ PKG_FILES = FileList[
|
|
14
14
|
|
15
15
|
spec = Gem::Specification.new do |s|
|
16
16
|
s.name = "super_map"
|
17
|
-
s.version = "1.0
|
17
|
+
s.version = "1.1.0"
|
18
18
|
s.author = "Marek Janukowicz"
|
19
19
|
s.email = "marek@janukowicz.net"
|
20
20
|
s.homepage = "http://www.bitbucket.org/starware/super_map"
|
data/lib/super_mapped_attr.rb
CHANGED
@@ -29,6 +29,9 @@ module SuperMappedAttr
|
|
29
29
|
# u.kind # 2
|
30
30
|
#
|
31
31
|
# User.kinds # #SuperMap:0x....
|
32
|
+
#
|
33
|
+
# User.with_kind( :member, :admin ).count.... (scope)
|
34
|
+
#
|
32
35
|
def super_mapped_attr( attr, map, options = {} )
|
33
36
|
|
34
37
|
if respond_to?( :validates_inclusion_of )
|
@@ -52,7 +55,13 @@ module SuperMappedAttr
|
|
52
55
|
end
|
53
56
|
|
54
57
|
(class << self; self; end).instance_eval do
|
58
|
+
|
55
59
|
define_method attr.to_s.pluralize, lambda { map }
|
60
|
+
|
61
|
+
define_method( "with_#{attr}" ) do |*keys|
|
62
|
+
where( attr => keys.collect { |key| map.value( key ) } )
|
63
|
+
end
|
64
|
+
|
56
65
|
end
|
57
66
|
|
58
67
|
end
|
metadata
CHANGED
@@ -1,74 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_map
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 1.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Marek Janukowicz
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-12-03 00:00:00 +01:00
|
19
|
-
default_executable:
|
11
|
+
date: 2016-08-25 00:00:00.000000000 Z
|
20
12
|
dependencies: []
|
21
|
-
|
22
13
|
description:
|
23
14
|
email: marek@janukowicz.net
|
24
15
|
executables: []
|
25
|
-
|
26
16
|
extensions: []
|
27
|
-
|
28
|
-
extra_rdoc_files:
|
17
|
+
extra_rdoc_files:
|
29
18
|
- README
|
30
|
-
files:
|
31
|
-
- Rakefile
|
19
|
+
files:
|
32
20
|
- README
|
21
|
+
- Rakefile
|
33
22
|
- lib/string_extensions.rb
|
34
|
-
- lib/super_mapped_attr.rb
|
35
23
|
- lib/super_map.rb
|
24
|
+
- lib/super_mapped_attr.rb
|
25
|
+
- test/en.yml
|
36
26
|
- test/super_map_test.rb
|
37
27
|
- test/super_mapped_attr_test.rb
|
38
|
-
- test/en.yml
|
39
|
-
has_rdoc: true
|
40
28
|
homepage: http://www.bitbucket.org/starware/super_map
|
41
29
|
licenses: []
|
42
|
-
|
30
|
+
metadata: {}
|
43
31
|
post_install_message:
|
44
32
|
rdoc_options: []
|
45
|
-
|
46
|
-
require_paths:
|
33
|
+
require_paths:
|
47
34
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
none: false
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 3
|
63
|
-
segments:
|
64
|
-
- 0
|
65
|
-
version: "0"
|
35
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
66
45
|
requirements: []
|
67
|
-
|
68
46
|
rubyforge_project:
|
69
|
-
rubygems_version:
|
47
|
+
rubygems_version: 2.4.8
|
70
48
|
signing_key:
|
71
|
-
specification_version:
|
49
|
+
specification_version: 4
|
72
50
|
summary: Swiss army knife of enum-based attributes
|
73
51
|
test_files: []
|
74
|
-
|