mpatch 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/lib/mpatch/str2duck.rb +1 -0
- data/mpatch.gemspec +2 -0
- metadata +18 -5
- data/lib/mpatch/active_support/str2duck.rb +0 -90
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2RkMzUzNmY4ZmRiN2EyZDk3ODhmNzVhZjcxZjc4OTg5YjYzN2IwZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjliZTYxNTU5OTBjODZmMThiYTdkZDExMDU5OTk1NmNiOWYwNDI0YQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDgyZDk5NWFmN2I3YTU5ODdhYzA1OTQwZTg2NDMzNzQ4OWE3OWMyNTY1NTIz
|
10
|
+
MDAzNzIxZmVhZjU3ZGY4OGYzMDU4Y2Q5NGQ1OGZhM2I5YjFhM2Q5ZGMwMzll
|
11
|
+
YTExN2FlMzI5MWNiOTRlOGRkZGNmMmFiYWZlMTc0YmM3ZTllMTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTNmY2VkYzY1YWM0ZDJmZGRjYzgzZjNjMjU1ODZkYjdjMWIxNGUzMzI2ZTUy
|
14
|
+
OGEyZWVkN2NkMWFkNmEwY2ZjZGIwYmMzMDZkZTkzNjYwNDZhMGMwYmYxM2U3
|
15
|
+
Njg5NjJmMTc5ZDlkMmUwMzc4YjVlNDg5YWQ5NTk2NjdmYzI0MzA=
|
data/Gemfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
source :rubygems
|
2
|
-
gemspec
|
2
|
+
gemspec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'str2duck'
|
data/mpatch.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mpatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-02-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: str2duck
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
description: This is a collection of my Ruby monkey patches for making easer to use
|
14
28
|
the basic classes
|
15
29
|
email:
|
@@ -25,7 +39,6 @@ files:
|
|
25
39
|
- create_folder.rb
|
26
40
|
- files.rb
|
27
41
|
- lib/mpatch.rb
|
28
|
-
- lib/mpatch/active_support/str2duck.rb
|
29
42
|
- lib/mpatch/array.rb
|
30
43
|
- lib/mpatch/boolean.rb
|
31
44
|
- lib/mpatch/class.rb
|
@@ -39,6 +52,7 @@ files:
|
|
39
52
|
- lib/mpatch/proc.rb
|
40
53
|
- lib/mpatch/process.rb
|
41
54
|
- lib/mpatch/random.rb
|
55
|
+
- lib/mpatch/str2duck.rb
|
42
56
|
- lib/mpatch/string.rb
|
43
57
|
- lib/mpatch/yml.rb
|
44
58
|
- mpatch.gemspec
|
@@ -67,4 +81,3 @@ signing_key:
|
|
67
81
|
specification_version: 4
|
68
82
|
summary: collection of methods for extend basic classes
|
69
83
|
test_files: []
|
70
|
-
has_rdoc:
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require File.join 'active_support','time'
|
2
|
-
|
3
|
-
class String
|
4
|
-
|
5
|
-
def duck
|
6
|
-
|
7
|
-
begin
|
8
|
-
if self == self.to_f.to_s
|
9
|
-
return self.to_f
|
10
|
-
end
|
11
|
-
rescue NoMethodError
|
12
|
-
end
|
13
|
-
|
14
|
-
begin
|
15
|
-
if self == self.to_i.to_s
|
16
|
-
return self.to_i
|
17
|
-
end
|
18
|
-
rescue NoMethodError
|
19
|
-
end
|
20
|
-
|
21
|
-
begin
|
22
|
-
if self.gsub(":","") == self.to_datetime.to_s.gsub(
|
23
|
-
"T"," ").gsub("+"," +").gsub(":","")
|
24
|
-
return self.to_datetime
|
25
|
-
end
|
26
|
-
rescue Exception
|
27
|
-
end
|
28
|
-
|
29
|
-
begin
|
30
|
-
if self == self.to_datetime.to_s
|
31
|
-
return self.to_datetime
|
32
|
-
end
|
33
|
-
rescue Exception
|
34
|
-
end
|
35
|
-
|
36
|
-
begin
|
37
|
-
if self == self.to_date.to_s
|
38
|
-
return self.to_date
|
39
|
-
end
|
40
|
-
rescue Exception
|
41
|
-
end
|
42
|
-
|
43
|
-
begin
|
44
|
-
if self == "true"
|
45
|
-
return true
|
46
|
-
end
|
47
|
-
rescue NoMethodError
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
begin
|
52
|
-
if self == "false"
|
53
|
-
return false
|
54
|
-
end
|
55
|
-
rescue NoMethodError
|
56
|
-
end
|
57
|
-
|
58
|
-
begin
|
59
|
-
string_input= self
|
60
|
-
contain= nil
|
61
|
-
["[", "]","^","$","*","/"].each do |one_sym|
|
62
|
-
if string_input.include? one_sym
|
63
|
-
contain ||= true
|
64
|
-
end
|
65
|
-
end
|
66
|
-
if contain == true
|
67
|
-
string_regexp= Regexp.new(string_input).inspect#.gsub('\\','')
|
68
|
-
string_regexp= string_regexp[1..(string_regexp.length-2)]
|
69
|
-
if string_input == string_regexp
|
70
|
-
return Regexp.new(string_input)
|
71
|
-
else
|
72
|
-
raise ArgumentError,"invalid input string"
|
73
|
-
end
|
74
|
-
end
|
75
|
-
rescue ArgumentError
|
76
|
-
end
|
77
|
-
|
78
|
-
begin
|
79
|
-
if self == self.to_s.to_s
|
80
|
-
return self.to_s
|
81
|
-
end
|
82
|
-
rescue NoMethodError
|
83
|
-
end
|
84
|
-
|
85
|
-
end
|
86
|
-
|
87
|
-
alias :to_duck :duck
|
88
|
-
alias :to_d :duck
|
89
|
-
|
90
|
-
end
|