corelib 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c08a3ca5b34a6ddd8b11858ef62c2601241c304d
4
+ data.tar.gz: a05179d07586a72de3b2e2a7d925ad61694cb835
5
+ SHA512:
6
+ metadata.gz: a879ef2f9ff08502ef1243f0ac57a0021c3028f547ccd00e450d0370e8bd89fbfe2f4b2dda5a9582252c5b43d0f77c00b2335891e990056b9e81cf421f2a1666
7
+ data.tar.gz: eec89274d86e911f3f299fa0f7b6c0db7cadcbb87b7f0a5ae597bceef4034a17938c7bf51fa6c61f6618b6ff92d0a87a17022274fe028cc350801ca10d801bdc
@@ -26,4 +26,10 @@ class Array
26
26
  !self.empty?
27
27
  end
28
28
 
29
+ def add_all(arr, options={})
30
+ flatten = options.fetch(:flatten, true)
31
+ a = flatten ? arr.flatten : arr
32
+ self.concat(a)
33
+ end
34
+
29
35
  end
@@ -1,3 +1,3 @@
1
1
  module Corelib
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -70,4 +70,21 @@ describe Array do
70
70
  end
71
71
  end
72
72
 
73
+ describe "#add_all" do
74
+ it "adds items correctly" do
75
+ [].add_all([1,2]).should == [1,2]
76
+ end
77
+ it "does not create a new array" do
78
+ a = []
79
+ b = a.add_all([1,2])
80
+ a.should === b
81
+ end
82
+ it "flattens multidimensional array" do
83
+ [].add_all([0,[1,2]]).should == [0,1,2]
84
+ end
85
+ it "does not flatten multidimensional array when option is set" do
86
+ [].add_all([0,[1,2]], :flatten => false).should == [0,[1,2]]
87
+ end
88
+ end
89
+
73
90
  end
metadata CHANGED
@@ -1,41 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: corelib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Corlew Solutions
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-18 00:00:00.000000000 Z
11
+ date: 2013-08-07 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
- description: ! "\"Many languages provide a vast library of methods or functions for
31
- developers to use, whereas Ruby only provides basic (albeit powerful) building blocks.
32
- At best, this leads to more complex applications and time wasted writing code another
33
- developer has probably already written; at worst it results in core class extensions
34
- being placed in helper methods or on objects that have no business owning the methods.
35
- The lack of a good strategy for managing Ruby extentions really becomes apparent
36
- when a developer needs to share his extensions across multiple projects.\n\n Corelib
37
- aims to solve this problem by providing a central gem for developers to share extensions
38
- & additions to the Ruby core."
27
+ description: |-
28
+ "Many languages provide a vast library of methods or functions for developers to use, whereas Ruby only provides basic (albeit powerful) building blocks. At best, this leads to more complex applications and time wasted writing code another developer has probably already written; at worst it results in core class extensions being placed in helper methods or on objects that have no business owning the methods. The lack of a good strategy for managing Ruby extentions really becomes apparent when a developer needs to share his extensions across multiple projects.
29
+
30
+ Corelib aims to solve this problem by providing a central gem for developers to share extensions & additions to the Ruby core.
39
31
  email:
40
32
  - support@corlewsolutions.com
41
33
  executables: []
@@ -73,28 +65,27 @@ files:
73
65
  - spec/string/core_spec.rb
74
66
  homepage: https://github.com/corlewsolutions/corelib.git
75
67
  licenses: []
68
+ metadata: {}
76
69
  post_install_message:
77
70
  rdoc_options: []
78
71
  require_paths:
79
72
  - lib
80
73
  required_ruby_version: !ruby/object:Gem::Requirement
81
- none: false
82
74
  requirements:
83
- - - ! '>='
75
+ - - '>='
84
76
  - !ruby/object:Gem::Version
85
77
  version: '0'
86
78
  required_rubygems_version: !ruby/object:Gem::Requirement
87
- none: false
88
79
  requirements:
89
- - - ! '>='
80
+ - - '>='
90
81
  - !ruby/object:Gem::Version
91
82
  version: '0'
92
83
  requirements: []
93
84
  rubyforge_project:
94
- rubygems_version: 1.8.25
85
+ rubygems_version: 2.0.6
95
86
  signing_key:
96
- specification_version: 3
97
- summary: ! '"Useful extensions & additions to the Ruby core classes'
87
+ specification_version: 4
88
+ summary: '"Useful extensions & additions to the Ruby core classes'
98
89
  test_files:
99
90
  - spec/array/core_spec.rb
100
91
  - spec/array/helpers_spec.rb