dom 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dom.rb +9 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af86488c43e306be0a7fc24c9343b9c2aab9cb8e
|
4
|
+
data.tar.gz: a046070bdf9b9031aab60bd4e61c8b7f8280e503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d70cc43b27b7b5e473fb6c5c73613f8f6ec579f5a60f0f5a6ece248587bacb3228bcb78f38590d55d711cbac8e61db9bea31f9930932ce2a2f2e554e44f81b4
|
7
|
+
data.tar.gz: 7583a410834679d1f060451978da8e488828691fdde6f27e508ff3de43d25f1300b1b8eb8d8496ad74aa911afdc7d965484f36acc50bdc0db2752f2b96941b01
|
data/lib/dom.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
#!ruby
|
2
1
|
require "cgi"
|
3
2
|
require "stringio"
|
4
3
|
require "strscan"
|
5
4
|
|
6
5
|
module Dom
|
7
|
-
def self.attr h; h.map{|k, v| " #{hyphenize(k)}=\"#{v}\""}.join end
|
8
|
-
def self.hyphenize sym; sym.to_s.tr("_", "-") end
|
9
6
|
def self.compact; singleton_class.class_eval{alias :join :join_compact} end
|
10
7
|
def self.nested; singleton_class.class_eval{alias :join :join_nested} end
|
11
8
|
def self.pre; singleton_class.class_eval{alias :join :join_pre} end
|
12
|
-
def self.join_compact a, tag, s = ""
|
13
|
-
|
9
|
+
def self.join_compact a, tag, s = ""
|
10
|
+
a.map{|e| e.to_s.escape_html(tag)}.join(s)
|
11
|
+
end
|
12
|
+
def self.join_nested a, tag
|
13
|
+
"#$/#{join_compact(a, tag, $/).gsub(/^/, " ")}#$/"
|
14
|
+
end
|
14
15
|
def self.join_pre a, tag
|
15
|
-
"
|
16
|
-
"#{"-->#{join_compact(a, tag, "<!--#$/-->")}<!--".gsub(/^/, " ")}#$/"\
|
17
|
-
"-->"
|
16
|
+
"<!--#$/#{"-->#{join_compact(a, tag, "<!--#$/-->")}<!--".gsub(/^/, " ")}#$/-->"
|
18
17
|
end
|
18
|
+
def self.attr h; h.map{|k, v| " #{hyphenize(k)}=\"#{v}\""}.join end
|
19
|
+
def self.hyphenize sym; sym.to_s.tr("_", "-") end
|
19
20
|
end
|
20
21
|
|
21
22
|
module Kernel
|
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.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-07-
|
11
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: ''
|
14
14
|
email: []
|
@@ -17,7 +17,7 @@ extensions: []
|
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
19
|
- lib/dom.rb
|
20
|
-
homepage: http://
|
20
|
+
homepage: http://sawa.github.io/dom
|
21
21
|
licenses: []
|
22
22
|
metadata: {}
|
23
23
|
post_install_message:
|
@@ -36,7 +36,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
36
36
|
version: '0'
|
37
37
|
requirements: []
|
38
38
|
rubyforge_project:
|
39
|
-
rubygems_version: 2.0.
|
39
|
+
rubygems_version: 2.0.6
|
40
40
|
signing_key:
|
41
41
|
specification_version: 4
|
42
42
|
summary: Creates HTML DOM strings
|