rabl 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.6.9
4
+
5
+ * Adds support for generic template rendering (Thanks @ivanvanderbyl)
6
+ * Allow cache to be called with an explicit key (Thanks @databyte)
7
+
3
8
  ## 0.6.8
4
9
 
5
10
  * Fix Rails 3 resolution on Ruby < 1.9.2
data/README.md CHANGED
@@ -486,7 +486,7 @@ cache 'lists' # explicit key of 'lists'
486
486
  cache 'lists', expires_in: 1.hour
487
487
  ```
488
488
 
489
- The cache keyword is used from within the base template. It will ignore any cache keys specified in an extended template or within partials.
489
+ The cache keyword can be used from within the base template or any extended template including partials.
490
490
 
491
491
  ```ruby
492
492
  # app/views/users/index.json.rabl
@@ -496,15 +496,32 @@ cache @users # key = rabl/users/[cache_key]/users/[cache_key]/...
496
496
  extends "users/show"
497
497
  ```
498
498
 
499
- and within the inherited template:
499
+ And within the extended template:
500
500
 
501
501
  ```ruby
502
502
  # app/views/users/show.json.rabl
503
503
  object @user
504
- cache @user # will be ignored
504
+ cache @user # key = rabl/user/[cache_key]/...
505
505
 
506
506
  attributes :name, :email
507
507
  ```
508
+
509
+ Another example of extending your object templates.
510
+
511
+ ```ruby
512
+ # app/views/users/show.json.rabl
513
+ object @user
514
+
515
+ extends "users/user"
516
+ ```
517
+
518
+ ```ruby
519
+ # app/views/users/user.json.rabl
520
+ cache # key = rabl/user/[cache_key]/...
521
+
522
+ attributes :name, :email
523
+ ```
524
+
508
525
  Caching can significantly speed up the rendering of RABL templates in production and is strongly recommended when possible.
509
526
 
510
527
  ### Content Type Assignment ###
@@ -517,6 +534,26 @@ details, and if you have any ideas or patches please let me know.
517
534
  In the meantime, be sure to set the proper content-types if needed. This is usually pretty simple in both
518
535
  Rails and Padrino. I recommend a before_filter on that controller or directly specified in an action.
519
536
 
537
+ ### Rendering Templates Directly ###
538
+
539
+ There are situations where an application requires RABL templates to be rendered outside
540
+ a traditional view context. For instance, to render RABL within a Rake task or to create
541
+ message queue payloads. For this case, `Rabl.render` can be used as show below:
542
+
543
+ ```ruby
544
+ Rabl.render(object, template, :view_path => 'app/views', :format => :json) #=> "{...json...}"
545
+ ```
546
+
547
+ You can use convenience methods on `Rabl::Renderer` to render the objects as well:
548
+
549
+ ```ruby
550
+ Rabl::Renderer.new(@post, 'posts/show', :view_path => 'app/views')
551
+ Rabl::Renderer.json(@post, 'posts/show')
552
+ Rabl::Renderer.xml(@post, 'posts/show')
553
+ ```
554
+
555
+ These methods allow RABL to be used for arbitrary conversions of an object into a desired format.
556
+
520
557
  ## Resources ##
521
558
 
522
559
  There are many resources available relating to RABL including the [RABL Wiki](https://github.com/nesquena/rabl/wiki),
@@ -585,7 +622,7 @@ Thanks to [Miso](http://gomiso.com) for allowing me to create this for our appli
585
622
 
586
623
  * [Nathan Esquenazi](https://github.com/nesquena) - Creator of the project
587
624
  * [Arthur Chiu](https://github.com/achiu) - Core Maintainer, Riot Testing Guru
588
- * [Tim Lee](https://github.com/timothy1ee) - RABL is an awesome name and was chosen by the Miso CTO.
625
+ * [Tim Lee](https://github.com/timothy1ee) - RABL was a great name chosen by the Miso CTO.
589
626
  * [David Sommers](https://github.com/databyte) - Enhanced template resolution and added caching support
590
627
  * [Rick Thomas](https://github.com/rickthomasjr) - Added options for extends and Sinatra testing
591
628
  * [Benjamin Yu](https://github.com/byu) - Added msgpack format support
@@ -598,6 +635,7 @@ Thanks to [Miso](http://gomiso.com) for allowing me to create this for our appli
598
635
  * [Andrey Voronkov](https://github.com/Antiarchitect) - Added BSON format support
599
636
  * [Alli Witheford](https://github.com/alzeih) - Added Plist format support
600
637
  * [Ryan Bigg](https://github.com/radar) - Improved template resolution code
638
+ * [Ivan Vanderbyl](https://github.com/ivanvanderbyl) - Added general purpose renderer
601
639
 
602
640
  and many more contributors listed in the [CHANGELOG](https://github.com/nesquena/rabl/blob/master/CHANGELOG.md).
603
641
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '3.2.2'
3
+ gem 'rails', '3.2.3'
4
4
 
5
5
  # Bundle edge Rails instead:
6
6
  # gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -14,7 +14,6 @@ context "PostsController" do
14
14
 
15
15
  setup do
16
16
  create_users!
17
- Rails.cache.clear
18
17
  Post.delete_all
19
18
  @post1 = Post.create(:title => "Foo", :body => "Bar", :user_id => @user1.id)
20
19
  @post2 = Post.create(:title => "Baz", :body => "Bah", :user_id => @user2.id)
@@ -132,6 +131,7 @@ context "PostsController" do
132
131
 
133
132
  setup do
134
133
  mock(ActionController::Base).perform_caching.any_number_of_times { true }
134
+ Rails.cache.clear
135
135
  end
136
136
 
137
137
  context "for index action with caching in json" do
@@ -10,12 +10,15 @@ require 'rabl/partials'
10
10
  require 'rabl/engine'
11
11
  require 'rabl/builder'
12
12
  require 'rabl/configuration'
13
+ require 'rabl/renderer'
13
14
  require 'rabl/railtie' if defined?(Rails) && Rails.version =~ /^3/
14
15
 
15
16
  # Rabl.register!
16
17
  module Rabl
17
18
  class << self
18
19
 
20
+ # Initialize RABL within an application
21
+ # Rabl.register!
19
22
  def register!
20
23
  require 'rabl/template'
21
24
  end
@@ -61,6 +64,12 @@ module Rabl
61
64
  @_source_cache = {}
62
65
  end
63
66
 
67
+ # Renders an object using a specified template within an application.
68
+ # render(@post, 'posts/show', :view_path => "/path/to/app/views")
69
+ def render(object, source, options = {})
70
+ Rabl::Renderer.new(source, object, options).render
71
+ end
72
+
64
73
  end
65
74
  end
66
75
 
@@ -2,6 +2,9 @@ module Rabl
2
2
  class Engine
3
3
  include Rabl::Partials
4
4
 
5
+ # List of supported rendering formats
6
+ FORMATS = [:json, :xml, :plist, :bson, :msgpack]
7
+
5
8
  # Constructs a new ejs engine based on given vars, handler and declarations
6
9
  # Rabl::Engine.new("...source...", { :format => "xml", :root => true, :view_path => "/path/to/views" })
7
10
  def initialize(source, options={})
@@ -9,6 +12,10 @@ module Rabl
9
12
  @_options = options
10
13
  end
11
14
 
15
+ def source=(string)
16
+ @_source = string
17
+ end
18
+
12
19
  # Renders the representation based on source, object, scope and locals
13
20
  # Rabl::Engine.new("...source...", { :format => "xml" }).render(scope, { :foo => "bar", :object => @user })
14
21
  def render(scope, locals, &block)
@@ -118,9 +125,10 @@ module Rabl
118
125
  # cache @user # calls @user.cache_key
119
126
  # cache ['rabl', @user] # calls @user.cache_key and prefixes with rabl/
120
127
  # cache 'user' # explicit key of 'user'
128
+ # cache # uses the current item within a collection
121
129
  # cache 'user', expires_in: 1.hour
122
130
  # options is passed through to the cache store
123
- def cache(key, options = nil)
131
+ def cache(key = nil, options = nil)
124
132
  key ||= @_data # if called but missing, use object
125
133
  @_cache = [key, options]
126
134
  end
@@ -161,7 +169,8 @@ module Rabl
161
169
  # Extends an existing rabl template with additional attributes in the block
162
170
  # extends("users/show", :object => @user) { attribute :full_name }
163
171
  def extends(file, options={}, &block)
164
- @_options[:extends].push({ :file => file, :options => options, :block => block })
172
+ extend_ops = options.merge(:view_path => options.fetch(:view_path, @_options[:view_path]))
173
+ @_options[:extends].push({ :file => file, :options => extend_ops, :block => block })
165
174
  end
166
175
 
167
176
  # Includes a helper module with a RABL template
@@ -31,16 +31,22 @@ module Rabl
31
31
  # fetch_source("show", :view_path => "...") => "...contents..."
32
32
  def fetch_source(file, options={})
33
33
  Rabl.source_cache(file, options[:view_path]) do
34
- file_path = if defined? Padrino
34
+ file_path = if defined?(Padrino) && context_scope.respond_to?(:settings)
35
35
  fetch_padrino_source(file, options)
36
- elsif defined?(Rails) && context_scope
36
+ elsif defined?(Rails) && context_scope.respond_to?(:view_paths)
37
37
  view_path = Array(options[:view_path] || context_scope.view_paths.to_a)
38
38
  fetch_rails_source(file, options) || fetch_manual_template(view_path, file)
39
- elsif defined? Sinatra
39
+ elsif defined?(Sinatra) && context_scope.respond_to?(:settings)
40
40
  fetch_sinatra_source(file, options)
41
+ else # generic template resolution
42
+ view_path = Array(options[:view_path])
43
+ fetch_manual_template(view_path, file)
44
+ end
45
+
46
+ unless File.exist?(file_path.to_s)
47
+ raise "Cannot find rabl template '#{file}' within registered (#{file_path}) view paths!"
41
48
  end
42
49
 
43
- raise "Cannot find rabl template '#{file}' within registered view paths!" unless File.exist?(file_path.to_s)
44
50
  [File.read(file_path.to_s), file_path.to_s] if file_path
45
51
  end
46
52
  end
@@ -0,0 +1,86 @@
1
+ module Rabl
2
+ class Renderer
3
+ # Defines class method rendering in supported formats
4
+ # Rabl::Renderer.json('posts/show', @post)
5
+ # Rabl::Renderer.xml('posts/show', @post)
6
+ Rabl::Engine::FORMATS.each do |fmt|
7
+ instance_eval <<-CODE
8
+ def #{fmt}(object, source, options = {})
9
+ new(source, object, options.merge(:format => :#{fmt})).render
10
+ end
11
+ CODE
12
+ end
13
+
14
+ # Public: Instantiate a new renderer
15
+ # This is a standalone class used for rendering rabl templates
16
+ # outside of a framework like Rails. You may want to use
17
+ # this when using Rabl to render the request objects passed to
18
+ # message queues.
19
+ #
20
+ # Example:
21
+ # renderer = Rabl::Renderer.new('template_name', user, { :format => 'json', :view_path => 'app/views' })
22
+ # renderer.render # => '{"user":{"name": "ivan" }}'
23
+ #
24
+ attr_reader :object, :options
25
+ def initialize(source, object = nil, options = {})
26
+ options = {
27
+ :format => :json,
28
+ :scope => self,
29
+ :view_path => []
30
+ }.update(options)
31
+
32
+ @options = options
33
+ @object = object
34
+ engine.source = self.process_source(source)
35
+ end
36
+
37
+ # Public: Actually render the template to the requested output format.
38
+ #
39
+ # - context_scope:
40
+ # Override the render scope to the 'scope' object. Defaults to self.
41
+ #
42
+ # Returns: And object representing the tranformed object in the requested format.
43
+ # e.g. json, xml, bson, plist
44
+ def render(context_scope = nil)
45
+ context_scope = context_scope ? context_scope : options.delete(:scope) || self
46
+ set_instance_variable(object) if context_scope == self
47
+ engine.render(context_scope, options.fetch(:locals, {}))
48
+ end
49
+
50
+ protected
51
+
52
+ def engine
53
+ @engine ||= Rabl::Engine.new(nil, options)
54
+ end
55
+
56
+ # Returns the source given a relative template path
57
+ def process_source(source)
58
+ return source if source.is_a?(String) && source =~ /\n/
59
+ source, _ = engine.fetch_source(source, { :view_path => options[:view_path] })
60
+ source
61
+ end
62
+
63
+ # Internal: Sets an instance variable named after the class of `object`
64
+ #
65
+ # Example:
66
+ # object.class.name # => User
67
+ # set_instance_variable(object) # => @user
68
+ #
69
+ def set_instance_variable(object)
70
+ name = model_name(object).split('/').last
71
+ instance_variable_set(:"@#{name}", object)
72
+ end
73
+
74
+ # Internal: Returns the model name for an object
75
+ #
76
+ # Example:
77
+ # model_name(@post) => "@post"
78
+ #
79
+ def model_name(object)
80
+ item = object.is_a?(Array) ? object.first : object
81
+ name = item.class.name.underscore
82
+ object.is_a?(Array) ? name.pluralize : name
83
+ end
84
+
85
+ end
86
+ end
@@ -1,3 +1,3 @@
1
1
  module Rabl
2
- VERSION = "0.6.8"
2
+ VERSION = "0.6.9"
3
3
  end
@@ -14,7 +14,6 @@ context "PostsController" do
14
14
 
15
15
  setup do
16
16
  create_users!
17
- Rails.cache.clear
18
17
  Post.delete_all
19
18
  @post1 = Post.create(:title => "Foo", :body => "Bar", :user_id => @user1.id)
20
19
  @post2 = Post.create(:title => "Baz", :body => "Bah", :user_id => @user2.id)
@@ -132,6 +131,7 @@ context "PostsController" do
132
131
 
133
132
  setup do
134
133
  mock(ActionController::Base).perform_caching.any_number_of_times { true }
134
+ Rails.cache.clear
135
135
  end
136
136
 
137
137
  context "for index action with caching in json" do
@@ -0,0 +1,150 @@
1
+ require 'tmpdir'
2
+ require 'pathname'
3
+
4
+ context "Rabl::Renderer" do
5
+ helper(:tmp_path) { @tmp_path ||= Pathname.new(Dir.mktmpdir) }
6
+ context "#render" do
7
+ asserts 'renders string as source' do
8
+ source = %q{
9
+ object @user
10
+ attribute :name, :as => 'city'
11
+ }
12
+
13
+ user = User.new(:name => 'irvine')
14
+
15
+ renderer = Rabl::Renderer.new(source, user, { :format => 'json', :root => true, :view_path => '/path/to/views' })
16
+ renderer.render
17
+ end.equals "{\"user\":{\"city\":\"irvine\"}}"
18
+
19
+ asserts 'allows redirecting scope to another object' do
20
+ source = %q{
21
+ object @user
22
+ attribute :name, :as => 'city'
23
+ }
24
+
25
+ scope = Object.new
26
+ scope.instance_variable_set :@user, User.new(:name => 'irvine')
27
+
28
+ renderer = Rabl::Renderer.new(source, nil, { :format => 'json', :scope => scope })
29
+ renderer.render
30
+ end.equals "{\"user\":{\"city\":\"irvine\"}}"
31
+
32
+ asserts 'accepts scope on render' do
33
+ source = %q{
34
+ object @user
35
+ attribute :name, :as => 'city'
36
+ }
37
+
38
+ scope = Object.new
39
+ scope.instance_variable_set :@user, User.new(:name => 'irvine')
40
+
41
+ renderer = Rabl::Renderer.new(source)
42
+ renderer.render(scope)
43
+ end.equals "{\"user\":{\"city\":\"irvine\"}}"
44
+
45
+ asserts 'passes :locals to render' do
46
+ source = %q{
47
+ attribute :name, :as => 'city'
48
+ }
49
+
50
+ scope = Object.new
51
+ user = User.new(:name => 'irvine')
52
+
53
+ renderer = Rabl::Renderer.new(source, nil, { :format => 'json', :locals => {:object => user} })
54
+ renderer.render
55
+ end.equals "{\"user\":{\"city\":\"irvine\"}}"
56
+
57
+
58
+ asserts 'loads source from file' do
59
+ File.open(tmp_path + "test.json.rabl", "w") do |f|
60
+ f.puts %q{
61
+ object @user
62
+ attributes :age, :name
63
+ }
64
+ end
65
+
66
+ user = User.new(:name => 'irvine')
67
+
68
+ renderer = Rabl::Renderer.new('test', user, :view_path => tmp_path)
69
+ renderer.render
70
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}"
71
+
72
+
73
+ asserts 'handles paths for extends' do
74
+ File.open(tmp_path + "test.json.rabl", "w") do |f|
75
+ f.puts %q{
76
+ attributes :age
77
+ }
78
+ end
79
+
80
+ File.open(tmp_path + "user.json.rabl", "w") do |f|
81
+ f.puts %(
82
+ object @user
83
+ attribute :name
84
+ extends 'test'
85
+ )
86
+ end
87
+
88
+ user = User.new(:name => 'irvine')
89
+
90
+ renderer = Rabl::Renderer.new('user', user, :view_path => tmp_path)
91
+ renderer.render
92
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}"
93
+
94
+ asserts 'Rabl.render calls Renderer' do
95
+ File.open(tmp_path + "test.json.rabl", "w") do |f|
96
+ f.puts %q{
97
+ object @user
98
+ attributes :age, :name
99
+ }
100
+ end
101
+
102
+ user = User.new(:name => 'irvine')
103
+
104
+ Rabl.render(user, 'test', :view_path => tmp_path)
105
+ end.equals "{\"user\":{\"age\":24,\"name\":\"irvine\"}}"
106
+ end
107
+
108
+ context '.json' do
109
+ asserts 'it renders json' do
110
+ File.open(tmp_path + "test.rabl", "w") do |f|
111
+ f.puts %q{
112
+ object @user
113
+ attributes :age, :name
114
+ }
115
+ end
116
+
117
+ user = User.new(:name => 'ivan')
118
+ Rabl::Renderer.json(user, 'test', :view_path => tmp_path)
119
+ end.equals "{\"user\":{\"age\":24,\"name\":\"ivan\"}}"
120
+ end
121
+
122
+ context '.msgpack' do
123
+ asserts 'it renders msgpack' do
124
+ File.open(tmp_path + "test.rabl", "w") do |f|
125
+ f.puts %q{
126
+ object @user
127
+ attributes :age, :name
128
+ }
129
+ end
130
+
131
+ user = User.new(:name => 'ivan')
132
+ Rabl::Renderer.msgpack(user, 'test', :view_path => tmp_path).split
133
+ end.equals "\x81\xA4user\x82\xA3age\x18\xA4name\xA4ivan".split
134
+ end
135
+
136
+ context '.plist' do
137
+ asserts 'it renders xml' do
138
+ File.open(tmp_path + "test.rabl", "w") do |f|
139
+ f.puts %q{
140
+ object @user
141
+ attributes :age, :name
142
+ }
143
+ end
144
+
145
+ user = User.new(:name => 'ivan')
146
+ Rabl::Renderer.plist(user, 'test', :view_path => tmp_path)
147
+ end.equals "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>user</key>\n\t<dict>\n\t\t<key>age</key>\n\t\t<integer>24</integer>\n\t\t<key>name</key>\n\t\t<string>ivan</string>\n\t</dict>\n</dict>\n</plist>\n"
148
+ end
149
+
150
+ end
metadata CHANGED
@@ -1,137 +1,183 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rabl
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.9
4
5
  prerelease:
5
- version: 0.6.8
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Nathan Esquenazi
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2012-04-04 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2012-04-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: activesupport
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 2.3.14
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: multi_json
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.3.14
30
+ - !ruby/object:Gem::Dependency
31
+ name: multi_json
32
+ requirement: !ruby/object:Gem::Requirement
30
33
  none: false
31
- requirements:
34
+ requirements:
32
35
  - - ~>
33
- - !ruby/object:Gem::Version
34
- version: "1.0"
36
+ - !ruby/object:Gem::Version
37
+ version: '1.0'
35
38
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: riot
39
39
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
- requirements:
42
+ requirements:
43
43
  - - ~>
44
- - !ruby/object:Gem::Version
44
+ - !ruby/object:Gem::Version
45
+ version: '1.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: riot
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
45
53
  version: 0.12.3
46
54
  type: :development
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: rr
50
55
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
52
57
  none: false
53
- requirements:
58
+ requirements:
54
59
  - - ~>
55
- - !ruby/object:Gem::Version
60
+ - !ruby/object:Gem::Version
61
+ version: 0.12.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: rr
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
56
69
  version: 1.0.2
57
70
  type: :development
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: rake
61
71
  prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
63
73
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: "0"
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.2
78
+ - !ruby/object:Gem::Dependency
79
+ name: rake
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
68
86
  type: :development
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
71
- name: tilt
72
87
  prerelease: false
73
- requirement: &id006 !ruby/object:Gem::Requirement
88
+ version_requirements: !ruby/object:Gem::Requirement
74
89
  none: false
75
- requirements:
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: "0"
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: tilt
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
79
102
  type: :development
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
82
- name: yajl-ruby
83
103
  prerelease: false
84
- requirement: &id007 !ruby/object:Gem::Requirement
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: yajl-ruby
112
+ requirement: !ruby/object:Gem::Requirement
85
113
  none: false
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "0"
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
90
118
  type: :development
91
- version_requirements: *id007
92
- - !ruby/object:Gem::Dependency
93
- name: msgpack
94
119
  prerelease: false
95
- requirement: &id008 !ruby/object:Gem::Requirement
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: msgpack
128
+ requirement: !ruby/object:Gem::Requirement
96
129
  none: false
97
- requirements:
130
+ requirements:
98
131
  - - ~>
99
- - !ruby/object:Gem::Version
132
+ - !ruby/object:Gem::Version
100
133
  version: 0.4.5
101
134
  type: :development
102
- version_requirements: *id008
103
- - !ruby/object:Gem::Dependency
104
- name: bson
105
135
  prerelease: false
106
- requirement: &id009 !ruby/object:Gem::Requirement
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.4.5
142
+ - !ruby/object:Gem::Dependency
143
+ name: bson
144
+ requirement: !ruby/object:Gem::Requirement
107
145
  none: false
108
- requirements:
146
+ requirements:
109
147
  - - ~>
110
- - !ruby/object:Gem::Version
148
+ - !ruby/object:Gem::Version
111
149
  version: 1.5.2
112
150
  type: :development
113
- version_requirements: *id009
114
- - !ruby/object:Gem::Dependency
115
- name: plist
116
151
  prerelease: false
117
- requirement: &id010 !ruby/object:Gem::Requirement
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ~>
156
+ - !ruby/object:Gem::Version
157
+ version: 1.5.2
158
+ - !ruby/object:Gem::Dependency
159
+ name: plist
160
+ requirement: !ruby/object:Gem::Requirement
118
161
  none: false
119
- requirements:
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: "0"
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
123
166
  type: :development
124
- version_requirements: *id010
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
125
174
  description: General ruby templating with json, bson, xml and msgpack support
126
- email:
175
+ email:
127
176
  - nesquena@gmail.com
128
177
  executables: []
129
-
130
178
  extensions: []
131
-
132
179
  extra_rdoc_files: []
133
-
134
- files:
180
+ files:
135
181
  - .gitignore
136
182
  - .travis.yml
137
183
  - CHANGELOG.md
@@ -346,6 +392,7 @@ files:
346
392
  - lib/rabl/helpers.rb
347
393
  - lib/rabl/partials.rb
348
394
  - lib/rabl/railtie.rb
395
+ - lib/rabl/renderer.rb
349
396
  - lib/rabl/template.rb
350
397
  - lib/rabl/version.rb
351
398
  - rabl.gemspec
@@ -365,37 +412,35 @@ files:
365
412
  - test/msgpack_engine_test.rb
366
413
  - test/partials_test.rb
367
414
  - test/plist_engine_test.rb
415
+ - test/renderer_test.rb
368
416
  - test/silence.rb
369
417
  - test/template_test.rb
370
418
  - test/teststrap.rb
371
419
  homepage: https://github.com/nesquena/rabl
372
420
  licenses: []
373
-
374
421
  post_install_message:
375
422
  rdoc_options: []
376
-
377
- require_paths:
423
+ require_paths:
378
424
  - lib
379
- required_ruby_version: !ruby/object:Gem::Requirement
425
+ required_ruby_version: !ruby/object:Gem::Requirement
380
426
  none: false
381
- requirements:
382
- - - ">="
383
- - !ruby/object:Gem::Version
384
- version: "0"
385
- required_rubygems_version: !ruby/object:Gem::Requirement
427
+ requirements:
428
+ - - ! '>='
429
+ - !ruby/object:Gem::Version
430
+ version: '0'
431
+ required_rubygems_version: !ruby/object:Gem::Requirement
386
432
  none: false
387
- requirements:
388
- - - ">="
389
- - !ruby/object:Gem::Version
390
- version: "0"
433
+ requirements:
434
+ - - ! '>='
435
+ - !ruby/object:Gem::Version
436
+ version: '0'
391
437
  requirements: []
392
-
393
438
  rubyforge_project: rabl
394
- rubygems_version: 1.8.19
439
+ rubygems_version: 1.8.21
395
440
  signing_key:
396
441
  specification_version: 3
397
442
  summary: General ruby templating with json, bson, xml and msgpack support
398
- test_files:
443
+ test_files:
399
444
  - test/bson_engine_test.rb
400
445
  - test/builder_test.rb
401
446
  - test/configuration_test.rb
@@ -411,6 +456,7 @@ test_files:
411
456
  - test/msgpack_engine_test.rb
412
457
  - test/partials_test.rb
413
458
  - test/plist_engine_test.rb
459
+ - test/renderer_test.rb
414
460
  - test/silence.rb
415
461
  - test/template_test.rb
416
462
  - test/teststrap.rb