hobson 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4135c4d5be2eb8cc9f6068d9e44d3f81142143d7
4
+ data.tar.gz: dbd51e9e262b99bdff15192a829a82b54edf70e0
5
+ SHA512:
6
+ metadata.gz: c67dea1b9875b5ced6802f5c05bb67dce993063da198a2a7873f5e08d3816d0446873a7b90bafc69b9b802be8748119d05ce4c59ce8dbb51a8fbb12ab2df92e6
7
+ data.tar.gz: 6fbb7b8bbd8f3f22749968a5373322d10ec8c39a43aa45dae17c77340c6ee9cc51d3cbdb3452ae40840e0b4ba7515cdf99976b3c5a4a01ac0792b9691618d80b
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Pluto and Bacon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # hobson
2
+
3
+ A collection of methods that extend the core capabilities of Ruby's built-in
4
+ classes and modules.
@@ -0,0 +1,25 @@
1
+ unless Enumerable.method_defined? :sum
2
+ #
3
+ module Enumerable
4
+ # Sums the elements of a collection by invoking their `+` method.
5
+ #
6
+ # The sum method is completely generic, it can work on any objects
7
+ # that respond to `+`.
8
+ #
9
+ # ["a", "b", "c"].sum #=> "abc"
10
+ #
11
+ # It is a good idea to provide a default value. The default value also
12
+ # acts as an initial value.
13
+ #
14
+ # [].sum #=> nil
15
+ # [].sum(9) #=> 9
16
+ #
17
+ # @param identity [Object] an optional default return value if there
18
+ # are no elements. It is nil by default.
19
+ # @return The sum of the elements or the default value if there are no
20
+ # elements.
21
+ def sum(identity = nil)
22
+ reduce(&:+) || identity
23
+ end # def sum
24
+ end # module Enumerable
25
+ end
@@ -0,0 +1 @@
1
+ require_relative 'enumerable/sum'
@@ -0,0 +1,17 @@
1
+ module Hobson
2
+ # Current major release.
3
+ # @return [Integer]
4
+ MAJOR = 0
5
+
6
+ # Current minor release.
7
+ # @return [Integer]
8
+ MINOR = 1
9
+
10
+ # Current patch level.
11
+ # @return [Integer]
12
+ PATCH = 0
13
+
14
+ # Full release version.
15
+ # @return [String]
16
+ VERSION = [MAJOR, MINOR, PATCH].join('.').freeze
17
+ end # module Hobson
data/lib/hobson.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'hobson/version'
2
+ require 'hobson/core_extensions/enumerable'
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hobson
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - plutonbacon
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.11.2
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.11.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 11.1.2
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 11.1.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.39.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.39.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.4.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.4.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.10.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.10.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: yard
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.8.7.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.8.7.6
97
+ description:
98
+ email:
99
+ - plutonbacon@dynosoft.org
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - LICENSE
105
+ - README.md
106
+ - lib/hobson.rb
107
+ - lib/hobson/core_extensions/enumerable.rb
108
+ - lib/hobson/core_extensions/enumerable/sum.rb
109
+ - lib/hobson/version.rb
110
+ homepage: https://github.com/plutonbacon/hobson.git
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: 2.0.0
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.5.1
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Extend the core capabilities of Ruby!
134
+ test_files: []
135
+ has_rdoc: