padrino-core 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5
1
+ 0.9.6
@@ -6,11 +6,13 @@ module Padrino
6
6
 
7
7
  private
8
8
  ##
9
- # Hijacking the sinatra render for do three thing:
9
+ # Hijacking the sinatra render for:
10
10
  #
11
11
  # * Use layout like rails do
12
12
  # * Use render 'path/to/my/template' (without symbols)
13
13
  # * Use render 'path/to/my/template' (with auto enegine lookup)
14
+ # * Use render 'path/to/template', :layout => false
15
+ # * Use render { :a => 1, :b => 2, :c => 3 } # => return a json string
14
16
  #
15
17
  def render(engine, data=nil, options={}, locals={}, &block)
16
18
  clear_template_cache!
@@ -18,6 +20,9 @@ module Padrino
18
20
  # If engine is an hash we convert to json
19
21
  return engine.to_json if engine.is_a?(Hash)
20
22
 
23
+ # Data can be a hash of options sometimes mistakenly
24
+ options.merge!(data) && data = nil if data.is_a?(Hash)
25
+
21
26
  # If an engine is a string probably is a path so we try to resolve them
22
27
  data, engine = *resolve_template(engine, options) if data.nil?
23
28
 
data/padrino-core.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{padrino-core}
8
- s.version = "0.9.5"
8
+ s.version = "0.9.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
12
- s.date = %q{2010-03-11}
12
+ s.date = %q{2010-03-15}
13
13
  s.default_executable = %q{padrino}
14
14
  s.description = %q{The Padrino core gem required for use of this framework}
15
15
  s.email = %q{padrinorb@gmail.com}
@@ -87,7 +87,7 @@ class TestApplication < Test::Unit::TestCase
87
87
  layout do
88
88
  "this is a <%= yield %>"
89
89
  end
90
-
90
+
91
91
  get("/"){ render :erb, "sinatra layout" }
92
92
  end
93
93
 
@@ -117,6 +117,21 @@ class TestApplication < Test::Unit::TestCase
117
117
  assert_equal "this is a rails way custom layout", body
118
118
  end
119
119
  end
120
+
121
+ should 'not use layout' do
122
+ with_layout do
123
+ with_view :index, "index" do
124
+ mock_app do
125
+ get("/with/layout"){ render :index }
126
+ get("/without/layout"){ render :index, :layout => false }
127
+ end
128
+ get "/with/layout"
129
+ assert_equal "this is a index", body
130
+ get "/without/layout"
131
+ assert_equal "index", body
132
+ end
133
+ end
134
+ end
120
135
  end
121
136
 
122
137
  context 'for application render functionality' do
@@ -231,7 +246,7 @@ class TestApplication < Test::Unit::TestCase
231
246
  yield
232
247
  @_out_buf << "SPARTA!"
233
248
  end
234
- def is; "IS." end
249
+ def is; "IS."; end
235
250
  get '/' do
236
251
  render :erb, '<% container do %> <%= is %> <% end %>'
237
252
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 5
9
- version: 0.9.5
8
+ - 6
9
+ version: 0.9.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Padrino Team
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-03-11 00:00:00 +01:00
20
+ date: 2010-03-15 00:00:00 -07:00
21
21
  default_executable: padrino
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency