dom 0.2.12 → 0.2.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dom.rb +9 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e3e8109c1a95328ff38ea23213be43fa8a06865
4
- data.tar.gz: d61374e6c2985930d0d7ae0d572a1bf5c2d8856b
3
+ metadata.gz: 5fcc9d16e2d98366cf60bcb4b83763a51453cff4
4
+ data.tar.gz: 2d1915dfd1d6f0a105f9cb50b81c0710d97bb000
5
5
  SHA512:
6
- metadata.gz: e880eadaae730af643e02a29ff85f569a2b4ebcddda509ec49eeffa5a7aafd59cdc8804b1c3e233852ffb5596340643919522645e65a50a55aa194da73329de8
7
- data.tar.gz: 2307e935d2a2fd80321f4d3c71f3ac5d4a7e6424a9b44a4934e042d53368d789460a3765ead8149bf3f9e3f67c83d33255b6dc4cd7a5b39cb2e0eadafdb11d39
6
+ metadata.gz: a31881d6d5ddf48288e53cf518f533e7eb36fdbce7f3d7ec647dd649ccec349c4567678e0cfa59f94346af8026f2771d85b68fae627f2176a2a92158b04d933b
7
+ data.tar.gz: 96a5e830017ddb0f9a29b90796e6225b65a04171cbe3a29a445ac376dc2af034a19769fe5c57989df217af5923e5b12678bbb7b033acebe61ac7813b8b920fd3
data/lib/dom.rb CHANGED
@@ -12,15 +12,18 @@ module Dom
12
12
  def self.compact; singleton_class.class_eval{alias join join_compact} end
13
13
  def self.nested; singleton_class.class_eval{alias join join_nested} end
14
14
  def self.pre; singleton_class.class_eval{alias join join_pre} end
15
- def self.join_compact a, tag, s = "".freeze
16
- a.map{|e| e.to_s.escape_html(tag)}.join(s)
15
+ def self.join_compact a, tag
16
+ a.map{|e| e.to_s.escape_html(tag)}.join
17
17
  end
18
18
  def self.join_nested a, tag
19
- "#$/%s#$/".freeze % join_compact(a, tag, $/).gsub(/^/o, " ".freeze)
19
+ a.map{|e| e.to_s.escape_html(tag).concat($/)}
20
+ .join.gsub(/^/o, Indent)
21
+ .prepend($/)
20
22
  end
21
23
  def self.join_pre a, tag
22
- "<!--#$/#{Indent}-->%s<!--#$/-->".freeze %
23
- join_compact(a, tag, "<!--#$/-->".freeze).gsub(/^/o, Indent)
24
+ a.map{|e| e.to_s.escape_html(tag).prepend("-->".freeze).concat("<!--#$/".freeze)}
25
+ .join.gsub(/^/o, Indent)
26
+ .prepend("<!--#$/".freeze).concat("-->".freeze)
24
27
  end
25
28
  def self.attr h; h.map{|k, v| " %s=\"%s\"".freeze % [hyphenize(k), v]}.join end
26
29
  def self.json_attr h; h.map{|k, v| [hyphenize(k), v]}.to_h end
@@ -109,4 +112,4 @@ class Array
109
112
  def jsonml tag, attr = nil; [Dom.hyphenize(tag), *([Dom.json_attr(attr)] if attr), *self] end
110
113
  end
111
114
 
112
- Dom.nested
115
+ Dom.compact
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.12
4
+ version: 0.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: ''
14
14
  email: []