inversion 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,10 @@
1
+ == v0.3.0 [2011-10-05] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ - Fix require loop in if/elsif tags
4
+ - Fixing a problem with HTML escaping of objects other than Strings
5
+ - Added render timing (Inversion::RenderState#time_elapsed)
6
+
7
+
1
8
  == v0.2.0 [2011-09-27] Michael Granger <ged@FaerieMUD.org>
2
9
 
3
10
  - Bugfixes (#1, #2)
@@ -26,10 +26,10 @@ module Inversion
26
26
  require 'inversion/monkeypatches'
27
27
 
28
28
  # Library version constant
29
- VERSION = '0.2.0'
29
+ VERSION = '0.3.0'
30
30
 
31
31
  # Version-control revision constant
32
- REVISION = %q$Revision: 896d23953a0a $
32
+ REVISION = %q$Revision: cde501e6764c $
33
33
 
34
34
  #
35
35
  # Logging
@@ -224,7 +224,7 @@ module Inversion
224
224
 
225
225
  ### Escape the given +output+ using HTML entity-encoding.
226
226
  def escape_html( output )
227
- return output.
227
+ return output.to_s.
228
228
  gsub( /&/, '&amp;' ).
229
229
  gsub( /</, '&lt;' ).
230
230
  gsub( />/, '&gt;' )
@@ -25,6 +25,7 @@ class Inversion::RenderState
25
25
  self.log.debug "Creating a render state with attributes: %p" %
26
26
  [ initial_attributes ]
27
27
 
28
+ @start_time = Time.now
28
29
  @containerstate = containerstate
29
30
  @options = Inversion::Template::DEFAULT_CONFIG.merge( options )
30
31
  @attributes = [ deep_copy(initial_attributes) ]
@@ -70,6 +71,9 @@ class Inversion::RenderState
70
71
  # The default error handler
71
72
  attr_reader :default_errhandler
72
73
 
74
+ # The Time the object was created
75
+ attr_reader :start_time
76
+
73
77
 
74
78
  ### Return the hash of attributes that are currently in effect in the
75
79
  ### rendering state.
@@ -315,6 +319,13 @@ class Inversion::RenderState
315
319
  end
316
320
 
317
321
 
322
+ ### Return the number of floting-point seconds that have passed since the
323
+ ### object was created. Used to time renders.
324
+ def time_elapsed
325
+ return Time.now - self.start_time
326
+ end
327
+
328
+
318
329
  ### Return a human-readable representation of the object.
319
330
  def inspect
320
331
  return "#<%p:0x%08x containerstate: %s, attributes: %s, destination: %p>" % [
@@ -184,7 +184,9 @@ class Inversion::Template
184
184
  # Post-render hook
185
185
  self.walk_tree {|node| node.after_rendering(state) }
186
186
 
187
- self.log.info " done rendering template 0x%08x" % [ self.object_id/2 ]
187
+ self.log.info " done rendering template 0x%08x: %0.4fs" %
188
+ [ self.object_id/2, state.time_elapsed ]
189
+
188
190
  return state.to_s
189
191
  end
190
192
  alias_method :to_s, :render
@@ -2,8 +2,9 @@
2
2
  # vim: set noet nosta sw=4 ts=4 :
3
3
 
4
4
  require 'inversion/template/attrtag'
5
- require 'inversion/template/iftag' unless defined?( Inversion::Template::IfTag )
6
5
  require 'inversion/template/commenttag'
6
+ require 'inversion/template/iftag' unless
7
+ defined?( Inversion::Template::IfTag )
7
8
 
8
9
 
9
10
  # Inversion 'elsif' tag.
@@ -4,8 +4,6 @@
4
4
  require 'inversion/mixins'
5
5
  require 'inversion/template/attrtag'
6
6
  require 'inversion/template/containertag'
7
- require 'inversion/template/elsiftag'
8
- require 'inversion/template/elsetag'
9
7
 
10
8
  # Inversion 'if' tag.
11
9
  #
@@ -177,6 +177,7 @@ describe Inversion::RenderState do
177
177
 
178
178
  end
179
179
 
180
+
180
181
  describe "render destinations" do
181
182
 
182
183
  it "can override the render destination for the duration of a block" do
@@ -364,5 +365,19 @@ describe Inversion::RenderState do
364
365
 
365
366
  end
366
367
 
368
+
369
+ describe "render timing" do
370
+
371
+ before( :each ) do
372
+ @state = Inversion::RenderState.new
373
+ end
374
+
375
+
376
+ it "knows how many floating-point seconds have passed since it was created" do
377
+ @state.time_elapsed.should be_a( Float )
378
+ end
379
+
380
+ end
381
+
367
382
  end
368
383
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inversion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -49,22 +49,22 @@ cert_chain:
49
49
  -----END CERTIFICATE-----
50
50
 
51
51
  '
52
- date: 2011-09-27 00:00:00.000000000Z
52
+ date: 2011-10-05 00:00:00.000000000Z
53
53
  dependencies:
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: hoe-mercurial
56
- requirement: &70311260655740 !ruby/object:Gem::Requirement
56
+ requirement: &70147534076140 !ruby/object:Gem::Requirement
57
57
  none: false
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 1.3.0
61
+ version: 1.3.1
62
62
  type: :development
63
63
  prerelease: false
64
- version_requirements: *70311260655740
64
+ version_requirements: *70147534076140
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: hoe-manualgen
67
- requirement: &70311260655280 !ruby/object:Gem::Requirement
67
+ requirement: &70147534075520 !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
70
70
  - - ~>
@@ -72,10 +72,10 @@ dependencies:
72
72
  version: 0.2.0
73
73
  type: :development
74
74
  prerelease: false
75
- version_requirements: *70311260655280
75
+ version_requirements: *70147534075520
76
76
  - !ruby/object:Gem::Dependency
77
77
  name: hoe-highline
78
- requirement: &70311260654860 !ruby/object:Gem::Requirement
78
+ requirement: &70147534074980 !ruby/object:Gem::Requirement
79
79
  none: false
80
80
  requirements:
81
81
  - - ~>
@@ -83,10 +83,10 @@ dependencies:
83
83
  version: 0.0.1
84
84
  type: :development
85
85
  prerelease: false
86
- version_requirements: *70311260654860
86
+ version_requirements: *70147534074980
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: rspec
89
- requirement: &70311260654400 !ruby/object:Gem::Requirement
89
+ requirement: &70147534074360 !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
92
92
  - - ~>
@@ -94,10 +94,10 @@ dependencies:
94
94
  version: 2.6.0
95
95
  type: :development
96
96
  prerelease: false
97
- version_requirements: *70311260654400
97
+ version_requirements: *70147534074360
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: tilt
100
- requirement: &70311260653980 !ruby/object:Gem::Requirement
100
+ requirement: &70147534073820 !ruby/object:Gem::Requirement
101
101
  none: false
102
102
  requirements:
103
103
  - - ~>
@@ -105,10 +105,10 @@ dependencies:
105
105
  version: 1.3.2
106
106
  type: :development
107
107
  prerelease: false
108
- version_requirements: *70311260653980
108
+ version_requirements: *70147534073820
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: sinatra
111
- requirement: &70311260653560 !ruby/object:Gem::Requirement
111
+ requirement: &70147534073200 !ruby/object:Gem::Requirement
112
112
  none: false
113
113
  requirements:
114
114
  - - ~>
@@ -116,10 +116,10 @@ dependencies:
116
116
  version: 1.2.6
117
117
  type: :development
118
118
  prerelease: false
119
- version_requirements: *70311260653560
119
+ version_requirements: *70147534073200
120
120
  - !ruby/object:Gem::Dependency
121
121
  name: rack-test
122
- requirement: &70311260653140 !ruby/object:Gem::Requirement
122
+ requirement: &70147534072680 !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
125
125
  - - ~>
@@ -127,10 +127,10 @@ dependencies:
127
127
  version: 0.6.0
128
128
  type: :development
129
129
  prerelease: false
130
- version_requirements: *70311260653140
130
+ version_requirements: *70147534072680
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: simplecov
133
- requirement: &70311260652720 !ruby/object:Gem::Requirement
133
+ requirement: &70147534072100 !ruby/object:Gem::Requirement
134
134
  none: false
135
135
  requirements:
136
136
  - - ~>
@@ -138,10 +138,10 @@ dependencies:
138
138
  version: 0.4.2
139
139
  type: :development
140
140
  prerelease: false
141
- version_requirements: *70311260652720
141
+ version_requirements: *70147534072100
142
142
  - !ruby/object:Gem::Dependency
143
143
  name: hoe-manualgen
144
- requirement: &70311260652300 !ruby/object:Gem::Requirement
144
+ requirement: &70147534071140 !ruby/object:Gem::Requirement
145
145
  none: false
146
146
  requirements:
147
147
  - - ~>
@@ -149,10 +149,10 @@ dependencies:
149
149
  version: 0.2.0
150
150
  type: :development
151
151
  prerelease: false
152
- version_requirements: *70311260652300
152
+ version_requirements: *70147534071140
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: trollop
155
- requirement: &70311260651860 !ruby/object:Gem::Requirement
155
+ requirement: &70147534069820 !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements:
158
158
  - - ~>
@@ -160,10 +160,10 @@ dependencies:
160
160
  version: 1.16.2
161
161
  type: :development
162
162
  prerelease: false
163
- version_requirements: *70311260651860
163
+ version_requirements: *70147534069820
164
164
  - !ruby/object:Gem::Dependency
165
165
  name: highline
166
- requirement: &70311260651440 !ruby/object:Gem::Requirement
166
+ requirement: &70147534069240 !ruby/object:Gem::Requirement
167
167
  none: false
168
168
  requirements:
169
169
  - - ~>
@@ -171,10 +171,10 @@ dependencies:
171
171
  version: 1.6.2
172
172
  type: :development
173
173
  prerelease: false
174
- version_requirements: *70311260651440
174
+ version_requirements: *70147534069240
175
175
  - !ruby/object:Gem::Dependency
176
176
  name: sysexits
177
- requirement: &70311260651020 !ruby/object:Gem::Requirement
177
+ requirement: &70147534068660 !ruby/object:Gem::Requirement
178
178
  none: false
179
179
  requirements:
180
180
  - - ~>
@@ -182,10 +182,10 @@ dependencies:
182
182
  version: 1.0.2
183
183
  type: :development
184
184
  prerelease: false
185
- version_requirements: *70311260651020
185
+ version_requirements: *70147534068660
186
186
  - !ruby/object:Gem::Dependency
187
187
  name: hoe
188
- requirement: &70311260650600 !ruby/object:Gem::Requirement
188
+ requirement: &70147534068080 !ruby/object:Gem::Requirement
189
189
  none: false
190
190
  requirements:
191
191
  - - ~>
@@ -193,7 +193,7 @@ dependencies:
193
193
  version: '2.12'
194
194
  type: :development
195
195
  prerelease: false
196
- version_requirements: *70311260650600
196
+ version_requirements: *70147534068080
197
197
  description: ! 'Inversion is a templating system for Ruby. It uses the "Inversion
198
198
  of Control" principle to decouple
199
199
 
metadata.gz.sig CHANGED
Binary file