marks 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/marks/marker.rb +13 -3
- data/lib/marks/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e86462ca450799da8d9cc00a1e189703a7e20ed
|
4
|
+
data.tar.gz: 3c4bf861b0d599b2f78e1c590aa3edcab2492bea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1604676f45f4152e59d2e38f432eec222eafed0d3cedce2911d57f49f9eb5c967a0b8bce8517efa8ca444bec4e0e9c0dde437648166e32edfe5c5f201b0ca9
|
7
|
+
data.tar.gz: 4755d17d2d6c7537fff745b08b138ccd7377d285918739a18e58ee447f8b22e5b0da8995b299dd53eea4cf4755e2c909fc5444118a5b5cb76dcbb8a8e675ba9d
|
data/lib/marks/marker.rb
CHANGED
@@ -21,19 +21,29 @@ module Marks
|
|
21
21
|
define_method :'marks?' do |markable, mark|
|
22
22
|
classified_mark = mark.to_s.classify
|
23
23
|
raise ArgumentError unless types.map { |t| t.to_s.classify }.include?(classified_mark)
|
24
|
-
|
24
|
+
if markable.has_attribute?('type')
|
25
|
+
markable_type = markable.class.base_class.name
|
26
|
+
else
|
27
|
+
markable_type = markable.class.name
|
28
|
+
end
|
29
|
+
outgoing_marks.where(mark_type: classified_mark, markable_type: markable_type, markable_id: markable).any?
|
25
30
|
end
|
26
31
|
|
27
32
|
define_method :'unmarks' do |markable, mark|
|
28
33
|
classified_mark = mark.to_s.classify
|
29
34
|
raise ArgumentError unless types.map { |t| t.to_s.classify }.include?(classified_mark)
|
30
|
-
|
35
|
+
if markable.has_attribute?('type')
|
36
|
+
markable_type = markable.class.base_class.name
|
37
|
+
else
|
38
|
+
markable_type = markable.class.name
|
39
|
+
end
|
40
|
+
outgoing_marks.where(mark_type: classified_mark, markable_type: markable_type, markable_id: markable).destroy_all
|
31
41
|
end
|
32
42
|
|
33
43
|
define_method :'markings' do |markable_class, mark|
|
34
44
|
classified_mark = mark.to_s.classify
|
35
45
|
raise ArgumentError unless types.map { |t| t.to_s.classify }.include?(classified_mark)
|
36
|
-
outgoing_marks.where(mark_type: classified_mark, markable_type: markable_class.
|
46
|
+
outgoing_marks.where(mark_type: classified_mark, markable_type: markable_class.name)
|
37
47
|
end
|
38
48
|
end
|
39
49
|
end
|
data/lib/marks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Ihara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.0.
|
107
|
+
rubygems_version: 2.0.3
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: An engine that enable you to mark any ActiveRecord model as many as you like
|