tagz 7.1.0 → 7.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/lib/tagz.rb +22 -11
  2. data/readme.erb +3 -0
  3. data/tagz.gemspec +1 -1
  4. metadata +6 -7
data/lib/tagz.rb CHANGED
@@ -3,7 +3,7 @@ unless defined? Tagz
3
3
  # core tagz functions
4
4
  #
5
5
  module Tagz
6
- def Tagz.version() '7.1.0' end
6
+ def Tagz.version() '7.2.0' end
7
7
 
8
8
  private
9
9
  # access tagz doc and enclose tagz operations
@@ -74,7 +74,7 @@ unless defined? Tagz
74
74
  tagz << content.join
75
75
  if block
76
76
  size = tagz.size
77
- value = block.call(tagz)
77
+ value = block.arity.abs >= 1 ? block.call(tagz) : block.call()
78
78
  tagz << value.to_s unless(tagz.size > size)
79
79
  end
80
80
  tagz.push "</#{ name }>"
@@ -151,9 +151,21 @@ unless defined? Tagz
151
151
  block ? @singleton_class.module_eval(&block) : @singleton_class
152
152
  end
153
153
 
154
- # hide away our own shit to minimize pollution
154
+ # hide away our own shit to minimize namespace pollution
155
155
  #
156
156
  module Namespace
157
+ namespace = self
158
+
159
+ Tagz.singleton_class{
160
+ define_method(:namespace){ |*args|
161
+ if args.empty?
162
+ namespace
163
+ else
164
+ namespace.const_get(args.first.to_sym)
165
+ end
166
+ }
167
+ }
168
+
157
169
  class Document < ::String
158
170
  def Document.for other
159
171
  Document === other ? other : Document.new(other.to_s)
@@ -207,7 +219,7 @@ unless defined? Tagz
207
219
  self
208
220
  end
209
221
  end
210
- Tagz.singleton_class{ define_method(:document){ Document } }
222
+ Tagz.singleton_class{ define_method(:document){ Tagz.namespace(:Document) } }
211
223
 
212
224
  class Element < ::String
213
225
  def Element.attributes options
@@ -257,7 +269,7 @@ unless defined? Tagz
257
269
  end
258
270
  end
259
271
  end
260
- Tagz.singleton_class{ define_method(:element){ Element } }
272
+ Tagz.singleton_class{ define_method(:element){ Tagz.namespace(:Element) } }
261
273
 
262
274
  module XChar
263
275
  # http://intertwingly.net/stories/2004/04/14/i18n.html#CleaningWindows
@@ -316,21 +328,20 @@ unless defined? Tagz
316
328
  ))
317
329
  end
318
330
  end
319
- Tagz.singleton_class{ define_method(:xchar){ XChar } }
331
+ Tagz.singleton_class{ define_method(:xchar){ Tagz.namespace(:XChar) } }
320
332
 
321
333
  NoEscapeProc = lambda{|*values| values.join}
322
- Tagz.singleton_class{ define_method(:no_escape_proc){ NoEscapeProc } }
334
+ Tagz.singleton_class{ define_method(:no_escape_proc){ Tagz.namespace(:NoEscapeProc) } }
323
335
 
324
336
  EscapeProc = lambda{|*values| Tagz.xchar.escape(values.join)}
325
- Tagz.singleton_class{ define_method(:escape_proc){ EscapeProc } }
337
+ Tagz.singleton_class{ define_method(:escape_proc){ Tagz.namespace(:EscapeProc) } }
326
338
 
327
339
  module Globally; include Tagz; end
328
- Tagz.singleton_class{ define_method(:globally){ Globally } }
340
+ Tagz.singleton_class{ define_method(:globally){ Tagz.namespace(:Globally) } }
329
341
 
330
342
  module Privately; include Tagz; end
331
- Tagz.singleton_class{ define_method(:privately){ Privately } }
343
+ Tagz.singleton_class{ define_method(:privately){ Tagz.namespace(:Privately) } }
332
344
  end
333
-
334
345
  remove_const(:Namespace)
335
346
 
336
347
  # escape utils
data/readme.erb CHANGED
@@ -97,6 +97,9 @@ URIS
97
97
  http://rubyforge.org/projects/codeforpeople
98
98
 
99
99
  HISTORY
100
+ 7.2.0
101
+ - ruby19 compat
102
+
100
103
  7.0.0
101
104
  - * IMPORTANT * NOT BACKWARD COMPATIBLE (thus version bump)
102
105
  the tagz functionality itself has not changed, but the defaults for
data/tagz.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification::new do |spec|
5
5
  spec.name = "tagz"
6
- spec.version = "7.1.0"
6
+ spec.version = "7.2.0"
7
7
  spec.platform = Gem::Platform::RUBY
8
8
  spec.summary = "tagz"
9
9
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tagz
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0
4
+ version: 7.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-28 00:00:00 -06:00
12
+ date: 2009-09-29 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,12 +22,10 @@ extensions: []
22
22
  extra_rdoc_files: []
23
23
 
24
24
  files:
25
- - lib
26
25
  - lib/tagz.rb
27
26
  - Rakefile
28
27
  - README
29
28
  - readme.erb
30
- - samples
31
29
  - samples/a.rb
32
30
  - samples/b.rb
33
31
  - samples/c.rb
@@ -36,10 +34,11 @@ files:
36
34
  - samples/f.rb
37
35
  - samples/g.rb
38
36
  - tagz.gemspec
39
- - test
40
37
  - test/tagz.rb
41
38
  has_rdoc: true
42
39
  homepage: http://github.com/ahoward/tagz/tree/master
40
+ licenses: []
41
+
43
42
  post_install_message:
44
43
  rdoc_options: []
45
44
 
@@ -60,9 +59,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
59
  requirements: []
61
60
 
62
61
  rubyforge_project: codeforpeople
63
- rubygems_version: 1.3.1
62
+ rubygems_version: 1.3.5
64
63
  signing_key:
65
- specification_version: 2
64
+ specification_version: 3
66
65
  summary: tagz
67
66
  test_files:
68
67
  - test/tagz.rb