myrrha 3.0.0.rc5 → 3.0.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/README.md +3 -2
- data/lib/myrrha/coercions.rb +2 -10
- data/lib/myrrha/version.rb +1 -1
- data/myrrha.gemspec +1 -1
- data/myrrha.noespec +2 -2
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ GEM
|
|
3
3
|
specs:
|
4
4
|
bluecloth (2.2.0)
|
5
5
|
diff-lcs (1.1.3)
|
6
|
-
domain (1.0.0.
|
6
|
+
domain (1.0.0.rc3)
|
7
7
|
rake (0.9.2.2)
|
8
8
|
rspec (2.8.0)
|
9
9
|
rspec-core (~> 2.8.0)
|
@@ -22,7 +22,7 @@ PLATFORMS
|
|
22
22
|
|
23
23
|
DEPENDENCIES
|
24
24
|
bluecloth (~> 2.2.0)
|
25
|
-
domain (~> 1.0.0.
|
25
|
+
domain (~> 1.0.0.rc3)
|
26
26
|
rake (~> 0.9.2)
|
27
27
|
rspec (~> 2.8.0)
|
28
28
|
wlang (~> 0.10.2)
|
data/README.md
CHANGED
@@ -308,12 +308,13 @@ A set of coercion rules can simply be created from scratch as follows:
|
|
308
308
|
|
309
309
|
# PRE: - user wants to coerce `value` to a requested_domain
|
310
310
|
# - belongs_to?(value, SourceDomain)
|
311
|
-
# -
|
311
|
+
# - TargetDomain <=> requested_domain
|
312
312
|
|
313
313
|
# implement the coercion or throw(:newrule)
|
314
314
|
returned_value = something(value)
|
315
315
|
|
316
|
-
# POST: returned_value belongs to
|
316
|
+
# POST: returned_value belongs either to TorgetDomain or to
|
317
|
+
# requested_domain (very smart converter)
|
317
318
|
|
318
319
|
end
|
319
320
|
|
data/lib/myrrha/coercions.rb
CHANGED
@@ -172,7 +172,7 @@ module Myrrha
|
|
172
172
|
got = convert(value, target_domain, converter)
|
173
173
|
return got
|
174
174
|
elsif subdomain?(target_domain, to)
|
175
|
-
got = convert(value,
|
175
|
+
got = convert(value, target_domain, converter)
|
176
176
|
return got if belongs_to?(got, target_domain)
|
177
177
|
end
|
178
178
|
end
|
@@ -223,15 +223,7 @@ module Myrrha
|
|
223
223
|
# otherwise.
|
224
224
|
#
|
225
225
|
def subdomain?(child, parent)
|
226
|
-
|
227
|
-
true
|
228
|
-
elsif parent.respond_to?(:super_domain_of?)
|
229
|
-
parent.super_domain_of?(child)
|
230
|
-
elsif child.respond_to?(:superclass) && child.superclass
|
231
|
-
subdomain?(child.superclass, parent)
|
232
|
-
else
|
233
|
-
false
|
234
|
-
end
|
226
|
+
parent >= child rescue false
|
235
227
|
end
|
236
228
|
|
237
229
|
# Extends existing rules
|
data/lib/myrrha/version.rb
CHANGED
data/myrrha.gemspec
CHANGED
@@ -128,7 +128,7 @@ Gem::Specification.new do |s|
|
|
128
128
|
s.add_development_dependency("yard", "~> 0.7.4")
|
129
129
|
s.add_development_dependency("bluecloth", "~> 2.2.0")
|
130
130
|
s.add_development_dependency("wlang", "~> 0.10.2")
|
131
|
-
s.add_dependency("domain", "~> 1.0.0.
|
131
|
+
s.add_dependency("domain", "~> 1.0.0.rc3")
|
132
132
|
|
133
133
|
# The version of ruby required by this gem
|
134
134
|
#
|
data/myrrha.noespec
CHANGED
@@ -10,7 +10,7 @@ variables:
|
|
10
10
|
upper:
|
11
11
|
Myrrha
|
12
12
|
version:
|
13
|
-
3.0.0.
|
13
|
+
3.0.0.rc6
|
14
14
|
summary: |-
|
15
15
|
Myrrha provides the coercion framework which is missing to Ruby.
|
16
16
|
description: |-
|
@@ -26,7 +26,7 @@ variables:
|
|
26
26
|
- http://github.com/blambeau/myrrha
|
27
27
|
- http://rubygems.org/gems/myrrha
|
28
28
|
dependencies:
|
29
|
-
- {name: domain, version: "~> 1.0.0.
|
29
|
+
- {name: domain, version: "~> 1.0.0.rc3", groups: [runtime] }
|
30
30
|
- {name: rake, version: "~> 0.9.2", groups: [test, release]}
|
31
31
|
- {name: rspec, version: "~> 2.8.0", groups: [test, release]}
|
32
32
|
- {name: yard, version: "~> 0.7.4", groups: [doc ]}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myrrha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.
|
4
|
+
version: 3.0.0.rc6
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 1.0.0.
|
101
|
+
version: 1.0.0.rc3
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 1.0.0.
|
109
|
+
version: 1.0.0.rc3
|
110
110
|
description: ! "Myrrha provides the coercion framework which is missing to Ruby. Coercions\nare
|
111
111
|
simply defined as a set of rules for converting values from source to target\ndomains
|
112
112
|
(in an abstract sense). As a typical and useful example, it comes with \na coerce()
|