rmtools 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/README.md +14 -2
- data/lib/rmtools/core/class.rb +2 -0
- data/lib/rmtools/dev/watching.rb +1 -1
- data/lib/rmtools/enumerable/array.rb +5 -3
- data/lib/rmtools/enumerable/hash.rb +4 -0
- data/lib/rmtools/enumerable/set_ops.rb +8 -2
- data/lib/rmtools/lang/ansi.rb +20 -20
- data/lib/rmtools/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9334478c59f448c6ac5a6693e6a91975533614e2
|
4
|
+
data.tar.gz: c1377abc4ccb7bfb4ae55b636ecbae31906a4ab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79964bcde63bb715714903d516507f60411510cb35de71fc83e441e7bb205f6b443ddfee9139f90a4f4447c95c5c9d7bb87eaf298ab2d2e1116755a57a16c437
|
7
|
+
data.tar.gz: aec618b40383d704a4ed558127bb77f52c950416769900ed56138c850ef916dd705fb8f45bc92939a6314d3ae642f10545a02d81c274752d09473865d1f4d507
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -27,14 +27,26 @@ It's still randomly documented since it's just my working tool.
|
|
27
27
|
|
28
28
|
### CHANGES
|
29
29
|
|
30
|
-
##### Version 2.
|
30
|
+
##### Version 2.3.4
|
31
31
|
|
32
|
+
* Ruby 2+ behaviour:
|
33
|
+
* Disabled C-extension
|
34
|
+
* Used String#encode instead of Iconv#iconv
|
35
|
+
|
32
36
|
* String
|
33
|
-
*
|
37
|
+
* Updated #digit_date to parse full english month names
|
38
|
+
|
39
|
+
##### Version 2.2.6
|
40
|
+
|
41
|
+
* String
|
42
|
+
* Added #utf? and #find_compatible_encoding. Currently, latter one differentiates only utf-8 and ansi-1251.
|
34
43
|
|
35
44
|
* Range
|
36
45
|
* #include? never raises an exception
|
37
46
|
|
47
|
+
* Array/Set
|
48
|
+
* Added #is_subset_of?
|
49
|
+
|
38
50
|
##### Version 2.2.4
|
39
51
|
|
40
52
|
* Hash
|
data/lib/rmtools/core/class.rb
CHANGED
data/lib/rmtools/dev/watching.rb
CHANGED
@@ -117,7 +117,7 @@ module RMTools
|
|
117
117
|
cmd = "scp #{fullpath.inspect} #{[@host, fpath].join(':').inspect} 2>&1"
|
118
118
|
print "`#{cmd}`: " if @debug
|
119
119
|
if res = RMTools::tick_while {`#{cmd}`}.b
|
120
|
-
puts "[ #{Painter.
|
120
|
+
puts "[ #{Painter.r_b('Error')} ]: #{res}"
|
121
121
|
else
|
122
122
|
print "[ #{Painter.g('OK')} ]"
|
123
123
|
end
|
@@ -222,9 +222,11 @@ class Array
|
|
222
222
|
foldl(:+, &b) || identity
|
223
223
|
end
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
225
|
+
if RUBY_VERSION < '2'
|
226
|
+
# fastering activesupport's method
|
227
|
+
def group_by(&b)
|
228
|
+
arrange(:group, &b)
|
229
|
+
end
|
228
230
|
end
|
229
231
|
|
230
232
|
end
|
@@ -14,7 +14,8 @@ module RMTools
|
|
14
14
|
alias :coallition :+
|
15
15
|
alias :subtraction :-
|
16
16
|
alias :intersection :&
|
17
|
-
|
17
|
+
# :& won't work this way if :intersection will be protected
|
18
|
+
protected :union, :coallition, :subtraction
|
18
19
|
|
19
20
|
def |(ary)
|
20
21
|
return ary.uniq if empty?
|
@@ -55,12 +56,17 @@ module RMTools
|
|
55
56
|
[self - common, ary - common]
|
56
57
|
end
|
57
58
|
|
58
|
-
alias diff
|
59
|
+
alias :diff :^
|
59
60
|
|
60
61
|
def intersects?(ary)
|
61
62
|
(self & ary).any?
|
62
63
|
end
|
63
64
|
alias :x? :intersects?
|
65
|
+
|
66
|
+
def =~(ary)
|
67
|
+
(self - ary).empty?
|
68
|
+
end
|
69
|
+
alias :is_subset_of? :=~
|
64
70
|
}
|
65
71
|
super
|
66
72
|
end
|
data/lib/rmtools/lang/ansi.rb
CHANGED
@@ -19,7 +19,7 @@ module RMTools
|
|
19
19
|
ANSI_ENCODING = ANSI_LETTERS_UC[0].encoding
|
20
20
|
end
|
21
21
|
|
22
|
-
ENCODINGS_PATTERNS["WINDOWS-1251"] = /[#{ANSI_LETTERS_UC.
|
22
|
+
ENCODINGS_PATTERNS["WINDOWS-1251"] = /[#{ANSI_LETTERS_UC.join}]/
|
23
23
|
end
|
24
24
|
|
25
25
|
if RUBY_VERSION < '2'
|
@@ -40,60 +40,60 @@ class String
|
|
40
40
|
|
41
41
|
if RUBY_VERSION < '2'
|
42
42
|
|
43
|
-
def utf(from_encoding=
|
44
|
-
|
43
|
+
def utf(from_encoding=encoding.name.upcase)
|
44
|
+
from_encoding += "//IGNORE"
|
45
|
+
(ICONVS["UTF-8<#{from_encoding}"] ||= Iconv.new('UTF-8//IGNORE', from_encoding)).iconv(self)
|
45
46
|
end
|
46
47
|
|
47
|
-
def ansi(from_encoding=
|
48
|
-
|
48
|
+
def ansi(from_encoding=encoding.name.upcase)
|
49
|
+
from_encoding += "//IGNORE"
|
50
|
+
(ICONVS["WINDOWS-1251<#{from_encoding}"] ||= Iconv.new('WINDOWS-1251//IGNORE', from_encoding)).iconv(self)
|
49
51
|
end
|
50
52
|
|
51
|
-
def utf!(from_encoding=
|
53
|
+
def utf!(from_encoding=encoding.name.upcase)
|
52
54
|
replace utf from_encoding
|
53
55
|
end
|
54
56
|
|
55
|
-
def ansi!(from_encoding=
|
57
|
+
def ansi!(from_encoding=encoding.name.upcase)
|
56
58
|
replace ansi from_encoding
|
57
59
|
end
|
58
60
|
|
59
61
|
else
|
60
62
|
|
61
|
-
def utf(from_encoding=
|
63
|
+
def utf(from_encoding="UTF-16")
|
62
64
|
encode(from_encoding, :invalid => :replace, :undef => :replace, :replace => "").encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => "")
|
63
65
|
end
|
64
66
|
|
65
|
-
def ansi(from_encoding=
|
67
|
+
def ansi(from_encoding="UTF-16")
|
66
68
|
encode(from_encoding, :invalid => :replace, :undef => :replace, :replace => "").encode("WINDOWS-1251", :invalid => :replace, :undef => :replace, :replace => "")
|
67
69
|
end
|
68
70
|
|
69
|
-
def utf!(from_encoding=
|
71
|
+
def utf!(from_encoding="UTF-16")
|
70
72
|
replace utf from_encoding
|
71
73
|
end
|
72
74
|
|
73
|
-
def ansi!(from_encoding=
|
75
|
+
def ansi!(from_encoding="UTF-16")
|
74
76
|
replace ansi from_encoding
|
75
77
|
end
|
76
78
|
|
77
79
|
end
|
78
80
|
|
79
81
|
|
80
|
-
def
|
82
|
+
def utf?
|
81
83
|
begin
|
82
|
-
self =~ /./
|
83
|
-
rescue
|
84
|
+
encoding == Encoding::UTF_8 and self =~ /./u
|
85
|
+
rescue Encoding::CompatibilityError
|
84
86
|
false
|
85
|
-
else
|
86
|
-
true
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
90
|
+
def find_compatible_encoding
|
91
91
|
# UTF-8 by default
|
92
|
-
return nil if
|
92
|
+
return nil if utf?
|
93
93
|
for enc, pattern in ENCODINGS_PATTERNS
|
94
94
|
force_encoding(enc)
|
95
|
-
if
|
96
|
-
return
|
95
|
+
if self =~ pattern
|
96
|
+
return enc
|
97
97
|
end
|
98
98
|
end
|
99
99
|
false
|
data/lib/rmtools/version.rb
CHANGED