rabl 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +4 -0
- data/lib/rabl/builder.rb +5 -1
- data/lib/rabl/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmMxOGI3M2JkYjU2OWVjNjRlNTI2NjlkYTY0Y2Q4ZWI0ZjgxODI4MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjE2YmIxNjQxMTllODk5NTcxNzgzNTUxOGUyZWFmNmIxM2VlOGYwZg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTU1YTdmZjc4MjBiMGYxMmJhODQxNTNlNDM4YmEzMTkzYjdmNzY1NTgzZWY1
|
10
|
+
N2Y3Zjk4NTAyNTcyOTM5ZGQzZmFhZTcwM2VmNTIzYTEwM2Q1ZGYzNzViNTE2
|
11
|
+
YTE1MjZhMTcxYjg0ZjYxZTlkYzA5ZWY3NGI3ODM0ZmQ1NjQxOTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGFmZmVhYThiOTY0NWM5OWViY2E3YTk5YjQ1YzRlZDZjNTEyNzUxNTIxZGFi
|
14
|
+
MGE2Zjk5NzFmYzQ4M2E5MWYwZTFmYmVkNzJiNDNlNWNmZGQ1NTAxMTM1MjUx
|
15
|
+
MzEzYjlmNzc2Y2MyMjg1MDM0ZTUzNzYyNmQ5ZWMzNmIxMTM2MTk=
|
data/CHANGELOG.md
CHANGED
data/lib/rabl/builder.rb
CHANGED
@@ -126,11 +126,14 @@ module Rabl
|
|
126
126
|
@_result.merge!(result) if result.is_a?(Hash)
|
127
127
|
end
|
128
128
|
|
129
|
+
# Evaluate conditions given a symbol to evaluate
|
129
130
|
def call_condition_proc(condition, object, &blk)
|
130
131
|
blk = lambda { |v| v } unless block_given?
|
131
132
|
if condition.respond_to?(:call)
|
133
|
+
# condition is a block to pass to the block
|
132
134
|
blk.call(condition.call(object))
|
133
135
|
elsif condition.is_a?(Symbol) && object.respond_to?(condition)
|
136
|
+
# condition is a property of the object
|
134
137
|
blk.call(object.send(condition))
|
135
138
|
else
|
136
139
|
false
|
@@ -147,7 +150,8 @@ module Rabl
|
|
147
150
|
result = options[:if] == true || call_condition_proc(options[:if], @_object)
|
148
151
|
end
|
149
152
|
if options.has_key?(:unless)
|
150
|
-
|
153
|
+
inverse_proc = lambda { |r| !r }
|
154
|
+
result = options[:unless] == false || call_condition_proc(options[:unless], @_object, &inverse_proc)
|
151
155
|
end
|
152
156
|
result
|
153
157
|
end
|
data/lib/rabl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|