procemon 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/procemon/function/proc_source/proc_source.rb +4 -0
- data/lib/procemon/mpatch/array.rb +72 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTVkYTA0MWEwOGQ0YjdhMzU2NjU1OWMzZjUyODdiOTU2MjMxYmFkOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzBiNjU4NWY0NjljNGFlM2Y0YmQ1MWZjMGE3NzBhNzFhMDI1NGNhMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2YxYTMyN2FjYjMxYzRjZGRiNTc2ZGYwNmEyNmVjY2JhZmM5ZDBlOGM2NDg4
|
10
|
+
NDcwMzRhOGNjNDExN2UxYTkyNTA0M2I4YjM2ZDQxNjcyZTcyMDM5NzgxODk5
|
11
|
+
NjAwZTVjZTU5OTJjY2IzMDdkNTQwOTQ0ZWIzM2Y4ZmI0YTgyZmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjZiZDlhM2Q2ZmQzNjQ2ZjA3NmJkOGNjMGMyYTViZWIzNjYxNjFjMzQ5YThh
|
14
|
+
YzY4Mzc4NTQ4N2RhMTVmN2E3ZGMxOTYyMzQ4NjgyYzc2MmVhZDkxZWYyNDE1
|
15
|
+
ZDg2OTlhYTU0NmNmMWEyMjQ4MmVkNzdiMzRkODE4MzE1MjFjNGM=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.3
|
@@ -41,6 +41,10 @@ class ProcSource < String
|
|
41
41
|
def body
|
42
42
|
|
43
43
|
body= ProcSourceBody.new(self.dup.to_s)
|
44
|
+
|
45
|
+
body.gsub!("{","{\n")
|
46
|
+
body.gsub!("}","\n}")
|
47
|
+
|
44
48
|
body.sub!(/^\s*Proc\.new\s*{ *[\S ]*/,String.new)
|
45
49
|
body.gsub!(/^$\n/, String.new)
|
46
50
|
body.sub!(/\s*}\s*$/,String.new)
|
@@ -53,6 +53,21 @@ class Array
|
|
53
53
|
(oth_array & self) == oth_array
|
54
54
|
end
|
55
55
|
|
56
|
+
# return boolean by other array
|
57
|
+
# if any element included from
|
58
|
+
# the oth_array, return a true
|
59
|
+
def contain_any_of?(oth_array)
|
60
|
+
oth_array.each do |element|
|
61
|
+
if self.include? element
|
62
|
+
return true
|
63
|
+
end
|
64
|
+
end
|
65
|
+
return false
|
66
|
+
end
|
67
|
+
|
68
|
+
alias :contains_any_of? :contain_any_of?
|
69
|
+
alias :has_any_of? :contain_any_of?
|
70
|
+
|
56
71
|
# do safe transpose
|
57
72
|
def safe_transpose
|
58
73
|
result = []
|
@@ -65,4 +80,61 @@ class Array
|
|
65
80
|
end
|
66
81
|
|
67
82
|
alias :contains? :contain?
|
83
|
+
|
84
|
+
# return boolean
|
85
|
+
# if any element class is equal to th given class
|
86
|
+
# return a true , else false
|
87
|
+
def contain_element_of_class?(class_name)
|
88
|
+
target_array= self.map{|e| e.class }.uniq
|
89
|
+
if class_name.class != Class
|
90
|
+
raise ArgumentError, "Argument must be a Class!"
|
91
|
+
end
|
92
|
+
if target_array.include? class_name
|
93
|
+
return true
|
94
|
+
end
|
95
|
+
return false
|
96
|
+
end
|
97
|
+
|
98
|
+
alias :contains_element_of_class? :contain_element_of_class?
|
99
|
+
alias :has_element_of_class? :contain_element_of_class?
|
100
|
+
|
101
|
+
# generate params structure from array
|
102
|
+
# *args => {:args,:opts}
|
103
|
+
def params_separation
|
104
|
+
|
105
|
+
options= self.map { |element|
|
106
|
+
if element.class == Hash
|
107
|
+
element
|
108
|
+
end
|
109
|
+
}.uniq - [ nil ]
|
110
|
+
#options.each{|e| self.delete(e) }
|
111
|
+
arguments= self.dup - options
|
112
|
+
options= Hash[*options]
|
113
|
+
|
114
|
+
return {
|
115
|
+
arguments: arguments,
|
116
|
+
args: arguments,
|
117
|
+
options: options,
|
118
|
+
opts: options
|
119
|
+
}
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
alias :separate_params :params_separation
|
124
|
+
alias :process_params :params_separation
|
125
|
+
|
126
|
+
# generate params structure from array
|
127
|
+
# *args - options {}
|
128
|
+
def extract_options!
|
129
|
+
options= self.map { |element|
|
130
|
+
if element.class == Hash
|
131
|
+
element
|
132
|
+
end
|
133
|
+
}.uniq - [ nil ]
|
134
|
+
options.each{|e| self.delete(e) }
|
135
|
+
return Hash[*options]
|
136
|
+
end
|
137
|
+
|
138
|
+
alias :get_options! :extract_options!
|
139
|
+
|
68
140
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
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-01-
|
11
|
+
date: 2014-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asynchronous
|