utilities 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -1
- data/lib/utilities/object.rb +6 -0
- data/lib/version.rb +1 -1
- data/test/test_utilities.rb +9 -0
- metadata +3 -5
data/README.md
CHANGED
@@ -29,7 +29,7 @@ Usage
|
|
29
29
|
|
30
30
|
[1,2,3].map_with([4,5,6]){|i,j| i * j } #=> [4,10,18]
|
31
31
|
|
32
|
-
*
|
32
|
+
* wrap
|
33
33
|
|
34
34
|
[1, 2, 3].wrap("*") #=> ["*1*", "*2*", "*3*"]
|
35
35
|
[1, 2, 3].wrap("*", "+") #=> ["*1+", "*2+", "*3+"]
|
@@ -98,6 +98,14 @@ Usage
|
|
98
98
|
nil.attempt(:something) #=> nil
|
99
99
|
"String".attempt(:wrong_method_name) #=> nil
|
100
100
|
|
101
|
+
* is_any?
|
102
|
+
|
103
|
+
Returns true if object is one of the passed classes
|
104
|
+
|
105
|
+
{}.is_any?(Array, Hash, Class) #=> true
|
106
|
+
"".is_any?(Array) #=> false
|
107
|
+
|
108
|
+
|
101
109
|
#### String
|
102
110
|
* hour_to_float
|
103
111
|
|
data/lib/utilities/object.rb
CHANGED
data/lib/version.rb
CHANGED
data/test/test_utilities.rb
CHANGED
@@ -199,3 +199,12 @@ describe Utilities::Statistics do
|
|
199
199
|
}
|
200
200
|
end
|
201
201
|
end
|
202
|
+
|
203
|
+
describe Object do
|
204
|
+
it "#is_any? should return true if object is in the classes and false otherwise" do
|
205
|
+
{:a => :b}.is_any?(Hash, Class).should be_true
|
206
|
+
[].is_any?(Hash, Class).should be_false
|
207
|
+
[].is_any?(Array).should be_true
|
208
|
+
"".is_any?(Array).should be_false
|
209
|
+
end
|
210
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,8 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
15
|
-
default_executable:
|
14
|
+
date: 2012-03-01 00:00:00.000000000 Z
|
16
15
|
dependencies: []
|
17
16
|
description: Few utilities include in all my projects, including a module for statistics,
|
18
17
|
some to_date and to_time functions as well as intersection method for Range object.
|
@@ -40,7 +39,6 @@ files:
|
|
40
39
|
- lib/version.rb
|
41
40
|
- test/test_utilities.rb
|
42
41
|
- utilities.gemspec
|
43
|
-
has_rdoc: true
|
44
42
|
homepage: http://github.com/christianblais/utilities
|
45
43
|
licenses: []
|
46
44
|
post_install_message:
|
@@ -62,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
60
|
version: '0'
|
63
61
|
requirements: []
|
64
62
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.8.15
|
66
64
|
signing_key:
|
67
65
|
specification_version: 3
|
68
66
|
summary: Few utilities include in all my projects
|