rabl 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rabl/engine.rb +4 -4
- data/lib/rabl/version.rb +1 -1
- metadata +5 -3
data/lib/rabl/engine.rb
CHANGED
@@ -15,7 +15,7 @@ module Rabl
|
|
15
15
|
@_locals, @_scope = locals, scope
|
16
16
|
self.copy_instance_variables_from(@_scope, [:@assigns, :@helpers])
|
17
17
|
@_options[:scope] = @_scope
|
18
|
-
@_options[:format] ||=
|
18
|
+
@_options[:format] ||= self.request_format
|
19
19
|
@_data = locals[:object] || self.default_object
|
20
20
|
instance_eval(@_source) if @_source.present?
|
21
21
|
instance_eval(&block) if block_given?
|
@@ -130,13 +130,13 @@ module Rabl
|
|
130
130
|
end
|
131
131
|
|
132
132
|
# Returns a guess at the format in this scope
|
133
|
-
#
|
134
|
-
def
|
133
|
+
# request_format => "xml"
|
134
|
+
def request_format
|
135
135
|
format = self.request_params.has_key?(:format) ? @_scope.params[:format] : nil
|
136
136
|
if request = @_scope.respond_to?(:request) && @_scope.request
|
137
137
|
format ||= request.format.to_sym.to_s if request.respond_to?(:format)
|
138
138
|
end
|
139
|
-
format
|
139
|
+
format && self.respond_to?("to_#{format}") ? format : "json"
|
140
140
|
end
|
141
141
|
|
142
142
|
# Returns the request parameters if available in the scope
|
data/lib/rabl/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Nathan Esquenazi
|
@@ -10,7 +10,8 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-19 00:00:00
|
13
|
+
date: 2011-05-19 00:00:00 -07:00
|
14
|
+
default_executable:
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: riot
|
@@ -89,6 +90,7 @@ files:
|
|
89
90
|
- test/models/user.rb
|
90
91
|
- test/template_test.rb
|
91
92
|
- test/teststrap.rb
|
93
|
+
has_rdoc: true
|
92
94
|
homepage: https://github.com/nesquena/rabl
|
93
95
|
licenses: []
|
94
96
|
|
@@ -112,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
114
|
requirements: []
|
113
115
|
|
114
116
|
rubyforge_project: rabl
|
115
|
-
rubygems_version: 1.
|
117
|
+
rubygems_version: 1.6.2
|
116
118
|
signing_key:
|
117
119
|
specification_version: 3
|
118
120
|
summary: General ruby templating for json or xml
|