rmtools 2.3.4 → 2.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9334478c59f448c6ac5a6693e6a91975533614e2
4
- data.tar.gz: c1377abc4ccb7bfb4ae55b636ecbae31906a4ab5
3
+ metadata.gz: 4f89fb064bdad91177d656c4ce69b064c7418b80
4
+ data.tar.gz: d548260567cfd5d51c58967dd7ee154d9d1bae82
5
5
  SHA512:
6
- metadata.gz: 79964bcde63bb715714903d516507f60411510cb35de71fc83e441e7bb205f6b443ddfee9139f90a4f4447c95c5c9d7bb87eaf298ab2d2e1116755a57a16c437
7
- data.tar.gz: aec618b40383d704a4ed558127bb77f52c950416769900ed56138c850ef916dd705fb8f45bc92939a6314d3ae642f10545a02d81c274752d09473865d1f4d507
6
+ metadata.gz: 6c912ac5bbbaf5e3333d0bf2e7bfefe34852ba599e13d830130c4e179ab1f773dc7de797e91be3d93de00a9f07bd3647df6720fbdfd62caf1d53102fba21ccbd
7
+ data.tar.gz: a1e616a1043461150d5b918e411e668c2bb745121bb9c96edb6951c79daeac9b40d35c7b83811b09f0e65a9532b0d26cb5ca7f258f8c47caba05ecd5d55bff4d
data/README.md CHANGED
@@ -27,7 +27,7 @@ It's still randomly documented since it's just my working tool.
27
27
 
28
28
  ### CHANGES
29
29
 
30
- ##### Version 2.3.4
30
+ ##### Version 2.3.5
31
31
 
32
32
  * Ruby 2+ behaviour:
33
33
  * Disabled C-extension
@@ -35,18 +35,17 @@ It's still randomly documented since it's just my working tool.
35
35
 
36
36
  * String
37
37
  * Updated #digit_date to parse full english month names
38
+ * #to_html and #to_xml make, respectively, html- and xml- formed documents by LibXML::XML
39
+ * #to_doc now is deprecated and is alias of #to_html
38
40
 
39
- ##### Version 2.2.6
41
+ ##### Version 2.2.5
40
42
 
41
43
  * String
42
- * Added #utf? and #find_compatible_encoding. Currently, latter one differentiates only utf-8 and ansi-1251.
44
+ * Added #fix_encoding! It differentiates only utf-8 and ansi-1251, though
43
45
 
44
46
  * Range
45
47
  * #include? never raises an exception
46
48
 
47
- * Array/Set
48
- * Added #is_subset_of?
49
-
50
49
  ##### Version 2.2.4
51
50
 
52
51
  * Hash
@@ -1,3 +1,3 @@
1
1
  module RMTools
2
- VERSION = '2.3.4'
2
+ VERSION = '2.3.5'
3
3
  end
@@ -57,24 +57,49 @@ class String
57
57
 
58
58
  end
59
59
 
60
- def to_doc(forceutf=nil)
60
+ def to_html(forceutf=nil)
61
61
  str = b || "<html/>"
62
62
  doc = if forceutf
63
- XML::HTMLParser.string(str.xml_to_utf, :options => 97,
64
- :encoding => XML::Encoding::UTF_8).parse
63
+ LibXML::XML::HTMLParser.string(str.xml_to_utf, :options => 97,
64
+ :encoding => LibXML::XML::Encoding::UTF_8).parse
65
65
  else
66
66
  begin
67
67
  if RUBY_VERSION > '1.9'
68
- XML::HTMLParser.string(str, :options => 97,
69
- :encoding => XML::Encoding.const_get(__ENCODING__.to_s.tr('-','_').to_sym)).parse
68
+ LibXML::XML::HTMLParser.string(str, :options => 97,
69
+ :encoding => LibXML::XML::Encoding.const_get(__ENCODING__.to_s.tr('-','_').to_sym)).parse
70
70
  else
71
- XML::HTMLParser.string(str, :options => 97).parse
71
+ LibXML::XML::HTMLParser.string(str, :options => 97).parse
72
72
  end
73
73
  rescue
74
74
  if enc = xml_charset
75
- XML::HTMLParser.string(str, :options => 97,
76
- :encoding => XML::Encoding.const_get(enc.upcase.tr('-','_').to_sym)).parse
77
- else to_doc :force
75
+ LibXML::XML::HTMLParser.string(str, :options => 97,
76
+ :encoding => LibXML::XML::Encoding.const_get(enc.upcase.tr('-','_').to_sym)).parse
77
+ else to_html :forceutf
78
+ end
79
+ end
80
+ end
81
+ doc.order_elements!
82
+ doc
83
+ end
84
+ alias :to_doc :to_html # DEPRECATED
85
+
86
+ def to_xml(forceutf=nil)
87
+ doc = if forceutf
88
+ LibXML::XML::Document.string(xml_to_utf, :options => 97,
89
+ :encoding => LibXML::XML::Encoding::UTF_8)
90
+ else
91
+ begin
92
+ if RUBY_VERSION > '1.9'
93
+ LibXML::XML::Document.string(self, :options => 97,
94
+ :encoding => LibXML::XML::Encoding.const_get(__ENCODING__.to_s.tr('-','_').to_sym))
95
+ else
96
+ LibXML::XML::Document.string(self, :options => 97)
97
+ end
98
+ rescue
99
+ if enc = xml_charset
100
+ LibXML::XML::Document.string(self, :options => 97,
101
+ :encoding => LibXML::XML::Encoding.const_get(enc.upcase.tr('-','_').to_sym))
102
+ else to_xml :forceutf
78
103
  end
79
104
  end
80
105
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rmtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.4
4
+ version: 2.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Baev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-27 00:00:00.000000000 Z
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport