utilities 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -29,6 +29,11 @@ Usage
29
29
 
30
30
  [1,2,3].map_with([4,5,6]){|i,j| i * j } #=> [4,10,18]
31
31
 
32
+ * warp
33
+
34
+ [1, 2, 3].wrap("*") #=> ["*1*", "*2*", "*3*"]
35
+ [1, 2, 3].wrap("*", "+") #=> ["*1+", "*2+", "*3+"]
36
+
32
37
  #### Enumerable
33
38
  * collect_first
34
39
 
@@ -41,4 +41,10 @@ class Array
41
41
  extend(Utilities::Statistics)
42
42
  end
43
43
  alias_method :to_stats!, :to_stat!
44
+
45
+ def wrap left_and_right, right = nil
46
+ left_and_right = left_and_right.to_s
47
+ right = right.nil? ? left_and_right : right.to_s
48
+ map {|item| [left_and_right.to_s, item.to_s, right.to_s].join}
49
+ end
44
50
  end
@@ -1,7 +1,7 @@
1
1
  module Utilities
2
2
  MAJOR = 0
3
3
  MINOR = 0
4
- BUILD = 21
4
+ BUILD = 22
5
5
 
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{BUILD}"
7
7
  end
@@ -34,6 +34,14 @@ describe Array do
34
34
  [].methods.include?(:statistics).should == false
35
35
  [].to_stat.methods.include?(:statistics).should == true
36
36
  end
37
+
38
+ it "#wrap should wrap the array as strings with the given parameters" do
39
+ a = [1, 2, 3]
40
+ b = ["a", "b", "c"]
41
+
42
+ a.wrap("t").should == ["t1t", "t2t", "t3t"]
43
+ b.wrap("c", "d").should == ["cad", "cbd", "ccd"]
44
+ end
37
45
  end
38
46
 
39
47
  describe Enumerable do
metadata CHANGED
@@ -1,37 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: utilities
3
- version: !ruby/object:Gem::Version
4
- hash: 53
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.22
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 21
10
- version: 0.0.21
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Christian Blais
14
9
  - Guillaume Malette
15
10
  - Louis-Mathieu Houle
16
11
  autorequire:
17
12
  bindir: bin
18
13
  cert_chain: []
19
-
20
- date: 2011-10-11 00:00:00 -04:00
14
+ date: 2011-10-17 00:00:00.000000000 -04:00
21
15
  default_executable:
22
16
  dependencies: []
23
-
24
- description: Few utilities include in all my projects, including a module for statistics, some to_date and to_time functions as well as intersection method for Range object.
25
- email:
17
+ description: Few utilities include in all my projects, including a module for statistics,
18
+ some to_date and to_time functions as well as intersection method for Range object.
19
+ email:
26
20
  - christ.blais@gmail.com
27
21
  - gmalette@gmail.com
28
22
  executables: []
29
-
30
23
  extensions: []
31
-
32
24
  extra_rdoc_files: []
33
-
34
- files:
25
+ files:
35
26
  - LICENSE
36
27
  - README.md
37
28
  - lib/utilities.rb
@@ -52,37 +43,27 @@ files:
52
43
  has_rdoc: true
53
44
  homepage: http://github.com/christianblais/utilities
54
45
  licenses: []
55
-
56
46
  post_install_message:
57
47
  rdoc_options: []
58
-
59
- require_paths:
48
+ require_paths:
60
49
  - lib
61
50
  - test
62
- required_ruby_version: !ruby/object:Gem::Requirement
51
+ required_ruby_version: !ruby/object:Gem::Requirement
63
52
  none: false
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- hash: 3
68
- segments:
69
- - 0
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
58
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 3
77
- segments:
78
- - 0
79
- version: "0"
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
80
63
  requirements: []
81
-
82
64
  rubyforge_project:
83
65
  rubygems_version: 1.6.2
84
66
  signing_key:
85
67
  specification_version: 3
86
68
  summary: Few utilities include in all my projects
87
69
  test_files: []
88
-