tokamak 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -43,10 +43,11 @@ module Tokamak
43
43
  def link(relationship, uri, options = {})
44
44
  # Start link array
45
45
  @current["link"] = [] unless @current["link"]
46
-
46
+ stringify_keys(options)
47
+
47
48
  options["rel"] = relationship.to_s
48
49
  options["href"] = uri
49
- options["type"] ||= options[:type] || "application/json"
50
+ options["type"] ||= "application/json"
50
51
  insert_value("link", nil, options)
51
52
  end
52
53
 
@@ -109,6 +110,11 @@ module Tokamak
109
110
  end
110
111
  end
111
112
 
113
+ def stringify_keys(hash)
114
+ hash.keys.each do |key|
115
+ hash[key.to_s] = hash.delete(key)
116
+ end
117
+ end
112
118
  end
113
119
  end
114
120
  end
@@ -8,7 +8,7 @@ module Tokamak
8
8
 
9
9
  # BlankSlate
10
10
  instance_methods.each do |m|
11
- undef_method m unless m.to_s =~ /\[\]|method_missing|respond_to\?|^__/
11
+ undef_method m unless m.to_s =~ /\[\]|method_missing|object_id|respond_to\?|^__/
12
12
  end
13
13
 
14
14
  def initialize(builder)
@@ -66,13 +66,12 @@ module Tokamak
66
66
  if defined? ::ActionView::Template and ::ActionView::Template.respond_to?(:register_template_handler)
67
67
  ::ActionView::Template
68
68
  else
69
+ if defined? ::ActionController::Base
70
+ ::ActionController::Base.exempt_from_layout :tokamak
71
+ end
69
72
  ::ActionView::Base
70
73
  end.register_template_handler(:tokamak, Tokamak)
71
74
 
72
- if defined? ::ActionController::Base
73
- ::ActionController::Base.exempt_from_layout :tokamak
74
- end
75
-
76
75
  end
77
76
  end
78
77
  end
@@ -2,7 +2,7 @@ module Tokamak
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- TINY = 4
5
+ TINY = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
 
@@ -1243,3 +1243,33 @@ Completed in 55ms (View: 53 | 200 OK [http://www.example.com/test/feed]
1243
1243
  Processing TestController#show (for 127.0.0.1 at 2011-02-16 16:46:22) [GET]
1244
1244
  Rendering test/show
1245
1245
  Completed in 4ms (View: 2 | 200 OK [http://www.example.com/test/show]
1246
+
1247
+
1248
+ Processing TestController#show (for 127.0.0.1 at 2011-02-24 08:48:24) [GET]
1249
+ Rendering test/show
1250
+ Completed in 105ms (View: 102 | 200 OK [http://www.example.com/test/show]
1251
+
1252
+
1253
+ Processing TestController#feed (for 127.0.0.1 at 2011-02-24 08:48:24) [GET]
1254
+ Rendering test/feed
1255
+ Completed in 69ms (View: 68 | 200 OK [http://www.example.com/test/feed]
1256
+
1257
+
1258
+ Processing TestController#show (for 127.0.0.1 at 2011-02-24 08:48:24) [GET]
1259
+ Rendering test/show
1260
+ Completed in 4ms (View: 2 | 200 OK [http://www.example.com/test/show]
1261
+
1262
+
1263
+ Processing TestController#show (for 127.0.0.1 at 2011-02-24 08:48:44) [GET]
1264
+ Rendering test/show
1265
+ Completed in 7ms (View: 6 | 200 OK [http://www.example.com/test/show]
1266
+
1267
+
1268
+ Processing TestController#feed (for 127.0.0.1 at 2011-02-24 08:48:44) [GET]
1269
+ Rendering test/feed
1270
+ Completed in 13ms (View: 11 | 200 OK [http://www.example.com/test/feed]
1271
+
1272
+
1273
+ Processing TestController#show (for 127.0.0.1 at 2011-02-24 08:48:44) [GET]
1274
+ Rendering test/show
1275
+ Completed in 4ms (View: 2 | 200 OK [http://www.example.com/test/show]
@@ -0,0 +1,12 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
2
+
3
+ class Tokamak::Builder::ValuesTest < Test::Unit::TestCase
4
+
5
+ def test_should_not_remove_important_methods
6
+ values = Tokamak::Builder::Values.new(nil)
7
+ assert values.respond_to? :method_missing
8
+ assert values.respond_to? :object_id
9
+ assert values.respond_to? :respond_to?
10
+ end
11
+
12
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokamak
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 4
10
- version: 1.1.4
9
+ - 5
10
+ version: 1.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Luis Cipriani
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-17 00:00:00 -02:00
18
+ date: 2011-02-24 00:00:00 -03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -207,6 +207,7 @@ files:
207
207
  - test/test_helper.rb
208
208
  - test/tokamak/builder/base_test.rb
209
209
  - test/tokamak/builder/json_test.rb
210
+ - test/tokamak/builder/values_test.rb
210
211
  - test/tokamak/builder/xml_test.rb
211
212
  - test/tokamak/helper_test.rb
212
213
  - test/tokamak/hook/rails_test.rb