junk_drawer 0.0.7 → 1.0.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: a0da0ad66a1221cb8d106b8364336f8039c09a6b
4
+ data.tar.gz: 20f73f5ec1a8501aaca7429d099baa271cf14fc6
5
+ SHA512:
6
+ metadata.gz: 6f7b51bfb7acd57c1f433080fc473bfc49e603b02071f3757fc824b9f9ba3f1a773b8ef2d4892d50f8e3a08dca07097aece39f296f5584197d85ef3aa66b56c6
7
+ data.tar.gz: 5dac68fde062e4e81d9f82a79138e00d0c21395349501e322b6599f365c714284555099feb2475afd34a61dfcbefa657bacb0dcfc3e482640f9f3913b5d3e911
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,82 @@
1
+ require: rubocop-rspec
2
+
3
+ AllCops:
4
+ DefaultFormatter: fuubar
5
+ TargetRubyVersion: 2.3
6
+ DisplayCopNames: true
7
+
8
+ Metrics/BlockLength:
9
+ Exclude:
10
+ - junk_drawer.gemspec
11
+ - spec/**/*_spec.rb
12
+
13
+ RSpec/ExampleLength:
14
+ Enabled: false
15
+
16
+ # default disabled rules
17
+ Style/AutoResourceCleanup:
18
+ Enabled: true
19
+
20
+ Style/CollectionMethods:
21
+ Enabled: true
22
+ PreferredMethods:
23
+ collect: 'map'
24
+ collect!: 'map!'
25
+ inject: 'reduce'
26
+ find: 'detect'
27
+ find_all: 'select'
28
+
29
+ Style/FirstArrayElementLineBreak:
30
+ Enabled: true
31
+
32
+ Style/FirstHashElementLineBreak:
33
+ Enabled: true
34
+
35
+ Style/FirstMethodArgumentLineBreak:
36
+ Enabled: true
37
+
38
+ Style/FirstMethodParameterLineBreak:
39
+ Enabled: true
40
+
41
+ Style/MultilineArrayBraceLayout:
42
+ Enabled: true
43
+
44
+ Style/MultilineHashBraceLayout:
45
+ Enabled: true
46
+
47
+ Style/MultilineMethodCallBraceLayout:
48
+ Enabled: true
49
+
50
+ Style/MultilineMethodDefinitionBraceLayout:
51
+ Enabled: true
52
+
53
+ Style/OptionHash:
54
+ Enabled: true
55
+
56
+ Style/Send:
57
+ Enabled: true
58
+
59
+ RSpec/VerifiedDoubles:
60
+ Enabled: true
61
+
62
+ # non-conventional rules
63
+ Style/LambdaCall:
64
+ EnforcedStyle: braces
65
+
66
+ Style/EmptyLinesAroundClassBody:
67
+ EnforcedStyle: empty_lines
68
+
69
+ Style/AccessModifierIndentation:
70
+ EnforcedStyle: outdent
71
+
72
+ Style/TrailingCommaInLiteral:
73
+ EnforcedStyleForMultiline: comma
74
+
75
+ Style/TrailingCommaInArguments:
76
+ EnforcedStyleForMultiline: consistent_comma
77
+
78
+ Style/TrailingCommaInArguments:
79
+ EnforcedStyleForMultiline: consistent_comma
80
+
81
+ Style/VariableNumber:
82
+ EnforcedStyle: snake_case
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.13.6
6
+ script:
7
+ - bundle exec rubocop
8
+ - bundle exec rake
9
+ - bundle exec rake build
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at lobatifricha@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
3
+
4
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+ guard :rspec, cmd: 'bundle exec rspec' do
3
+ require 'guard/rspec/dsl'
4
+ dsl = Guard::RSpec::Dsl.new(self)
5
+
6
+ # Feel free to open issues for suggestions and improvements
7
+
8
+ # RSpec files
9
+ rspec = dsl.rspec
10
+ watch(rspec.spec_helper) { rspec.spec_dir }
11
+ watch(rspec.spec_support) { rspec.spec_dir }
12
+ watch(rspec.spec_files)
13
+
14
+ # Ruby files
15
+ ruby = dsl.ruby
16
+ dsl.watch_spec_files_for(ruby.lib_files)
17
+ end
18
+
19
+ guard :rubocop do
20
+ watch(/.+\.rb$/)
21
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
22
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Robert Fletcher
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
13
+ all 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
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,3 +1,51 @@
1
1
  # JunkDrawer
2
2
 
3
- A set of Ruby core extensions that I found myself using across several of my projects.
3
+ Welcome to your new gem! In this directory, you'll find the files you need to
4
+ be able to package up your Ruby library into a gem. Put your Ruby code in the
5
+ file `lib/junk_drawer`. To experiment with that code, run `bin/console` for an
6
+ interactive prompt.
7
+
8
+ TODO: Delete this and the text above, and describe your gem
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'junk_drawer'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install junk_drawer
25
+
26
+ ## Usage
27
+
28
+ TODO: Write usage instructions here
29
+
30
+ ## Development
31
+
32
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
33
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
34
+ prompt that will allow you to experiment.
35
+
36
+ To install this gem onto your local machine, run `bundle exec rake install`. To
37
+ release a new version, update the version number in `version.rb`, and then run
38
+ `bundle exec rake release`, which will create a git tag for the version, push
39
+ git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
40
+
41
+ ## Contributing
42
+
43
+ Bug reports and pull requests are welcome on GitHub at
44
+ https://github.com/[USERNAME]/junk_drawer. This project is intended to be a
45
+ safe, welcoming space for collaboration, and contributors are expected to
46
+ adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
47
+
48
+
49
+ ## License
50
+
51
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+ require 'bundler/gem_tasks'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: :spec
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require_relative '../lib/junk_drawer'
6
+
7
+ require 'pry'
8
+ Pry.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ require_relative 'lib/junk_drawer/version'
3
+
4
+ Gem::Specification.new do |spec|
5
+ spec.name = 'junk_drawer'
6
+ spec.version = JunkDrawer::VERSION
7
+ spec.authors = ['Robert Fletcher']
8
+ spec.email = ['lobatifricha@gmail.com']
9
+
10
+ spec.summary = 'random useful Ruby utilities'
11
+ spec.homepage = 'https://github.com/mockdeep/junk_drawer'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
15
+ f.match(%r{^spec/})
16
+ end
17
+ spec.bindir = 'exe'
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.required_ruby_version = '>= 2.1'
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.13'
24
+ spec.add_development_dependency 'guard', '~> 2.14'
25
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
26
+ spec.add_development_dependency 'guard-rubocop', '~> 1.2'
27
+ spec.add_development_dependency 'pry', '~> 0.10'
28
+ spec.add_development_dependency 'rake', '~> 10.0'
29
+ spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.45.0'
31
+ spec.add_development_dependency 'rubocop-rspec', '~> 1.8.0'
32
+ spec.add_development_dependency 'simplecov', '~> 0.12'
33
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ module JunkDrawer
3
+ # error to be thrown by Callable
4
+ class CallableError < StandardError
5
+ end
6
+
7
+ # module to constrain interfaces of classes to just `call`
8
+ module Callable
9
+ def call
10
+ raise NotImplementedError
11
+ end
12
+
13
+ # `ClassMethods` defines a class level method `call` that delegates to
14
+ # an instance. It also causes an error to be raised if a public instance
15
+ # method is defined with a name other than `call`
16
+ module ClassMethods
17
+ def call(*args)
18
+ new.(*args)
19
+ end
20
+
21
+ def method_added(method_name)
22
+ return if method_name == :call || !public_method_defined?(method_name)
23
+
24
+ raise CallableError, "invalid method name #{method_name}, " \
25
+ 'only public method allowed is "call"'
26
+ end
27
+ end
28
+
29
+ def self.included(base)
30
+ base.public_send(:extend, ClassMethods)
31
+ end
32
+ end
33
+ end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module JunkDrawer
2
- VERSION = '0.0.7'
3
+ VERSION = '1.0.0'
3
4
  end
data/lib/junk_drawer.rb CHANGED
@@ -1 +1,7 @@
1
- %w(array hash kernel object object_id string time).each {|file| require "core_extensions/#{file}"}
1
+ # frozen_string_literal: true
2
+ require_relative 'junk_drawer/callable'
3
+ require_relative 'junk_drawer/version'
4
+
5
+ # namespace for all JunkDrawer code
6
+ module JunkDrawer
7
+ end
metadata CHANGED
@@ -1,94 +1,200 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: junk_drawer
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 7
9
- version: 0.0.7
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
10
5
  platform: ruby
11
- authors:
12
- - Chris Hanks
6
+ authors:
7
+ - Robert Fletcher
13
8
  autorequire:
14
- bindir: bin
9
+ bindir: exe
15
10
  cert_chain: []
16
-
17
- date: 2010-09-24 00:00:00 -07:00
18
- default_executable:
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
21
- name: all-your-base
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - "="
26
- - !ruby/object:Gem::Version
27
- segments:
28
- - 0
29
- - 3
30
- - 0
31
- version: 0.3.0
32
- type: :runtime
11
+ date: 2016-11-20 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.13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.13'
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '4.7'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '4.7'
55
+ - !ruby/object:Gem::Dependency
56
+ name: guard-rubocop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.2'
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'
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'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.0'
104
+ type: :development
33
105
  prerelease: false
34
- version_requirements: *id001
35
- description: A collection of Ruby core extensions and other goodies.
36
- email:
37
- - christopher.m.hanks@gmail.com
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.45.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.45.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.8.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.8.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: simplecov
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.12'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.12'
153
+ description:
154
+ email:
155
+ - lobatifricha@gmail.com
38
156
  executables: []
39
-
40
157
  extensions: []
41
-
42
158
  extra_rdoc_files: []
43
-
44
- files:
45
- - lib/junk_drawer/version.rb
46
- - lib/core_extensions/hash.rb
47
- - lib/core_extensions/object_id.rb
48
- - lib/core_extensions/array.rb
49
- - lib/core_extensions/object.rb
50
- - lib/core_extensions/kernel.rb
51
- - lib/core_extensions/string.rb
52
- - lib/core_extensions/time.rb
53
- - lib/junk_drawer.rb
54
- - LICENSE
159
+ files:
160
+ - ".gitignore"
161
+ - ".rspec"
162
+ - ".rubocop.yml"
163
+ - ".travis.yml"
164
+ - CODE_OF_CONDUCT.md
165
+ - Gemfile
166
+ - Guardfile
167
+ - LICENSE.txt
55
168
  - README.md
56
- - ROADMAP.md
57
- - CHANGELOG.md
58
- has_rdoc: true
59
- homepage: http://github.com/chanks/junk_drawer
60
- licenses: []
61
-
169
+ - Rakefile
170
+ - bin/console
171
+ - bin/setup
172
+ - junk_drawer.gemspec
173
+ - lib/junk_drawer.rb
174
+ - lib/junk_drawer/callable.rb
175
+ - lib/junk_drawer/version.rb
176
+ homepage: https://github.com/mockdeep/junk_drawer
177
+ licenses:
178
+ - MIT
179
+ metadata: {}
62
180
  post_install_message:
63
181
  rdoc_options: []
64
-
65
- require_paths:
182
+ require_paths:
66
183
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
184
+ required_ruby_version: !ruby/object:Gem::Requirement
185
+ requirements:
70
186
  - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 362845999
73
- segments:
74
- - 0
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
77
- none: false
78
- requirements:
187
+ - !ruby/object:Gem::Version
188
+ version: '2.1'
189
+ required_rubygems_version: !ruby/object:Gem::Requirement
190
+ requirements:
79
191
  - - ">="
80
- - !ruby/object:Gem::Version
81
- segments:
82
- - 1
83
- - 3
84
- - 6
85
- version: 1.3.6
192
+ - !ruby/object:Gem::Version
193
+ version: '0'
86
194
  requirements: []
87
-
88
- rubyforge_project: junk_drawer
89
- rubygems_version: 1.3.7
195
+ rubyforge_project:
196
+ rubygems_version: 2.6.8
90
197
  signing_key:
91
- specification_version: 3
92
- summary: A small collection of Ruby core extensions.
198
+ specification_version: 4
199
+ summary: random useful Ruby utilities
93
200
  test_files: []
94
-
data/CHANGELOG.md DELETED
File without changes
data/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2010 Chris Hanks
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/ROADMAP.md DELETED
File without changes
@@ -1,19 +0,0 @@
1
- class Array
2
- class ExpectedOneElementError < StandardError; end
3
-
4
- # To make sanity checking a bit easier.
5
- def only
6
- raise ExpectedOneElementError unless count == 1
7
- first
8
- end
9
-
10
- def hashify
11
- each_with_object({}) do |item, hash|
12
- hash[item.id] = item
13
- end
14
- end
15
-
16
- # For readability, especially after sorting.
17
- alias :highest :last
18
- alias :lowest :first
19
- end
@@ -1,16 +0,0 @@
1
- class Hash
2
- def needs(*keys)
3
- keys.each { |key| self[key] ||= '' }
4
- end
5
-
6
- alias :need :needs
7
-
8
- def keeps(*checks)
9
- delete_if do |key, value|
10
- checks.none? { |check| check === key }
11
- end
12
- end
13
-
14
- alias :keep :keeps
15
- alias :whitelist :keeps
16
- end
@@ -1,8 +0,0 @@
1
- module Kernel
2
- # An easy way to log and keep an eye on initialization routines, rake tasks, etc...
3
- def time(message, &block)
4
- start_time = Time.now
5
- yield
6
- puts "#{message}: #{"%0.3f" % (Time.now - start_time)} seconds"
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- class Object
2
- # ActiveSupport's Object#try has difficulties if you
3
- # try to use it on an instance of FalseClass (which
4
- # I often seem to end up doing). Therefore...
5
- def try(method, *args, &block)
6
- send(method, *args, &block) if respond_to? method
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- require 'all_your_base'
2
-
3
- module BSON
4
- class ObjectID
5
- # Translate ObjectID instances to a more human-friendly format.
6
- # The reverse operation is String#to_oid.
7
- # Requires the all-your-base gem.
8
- def to_display
9
- number = to_s.reverse.to_i(16)
10
- ::AllYourBase::Are.convert_from_base_10 number, :radix => 62
11
- end
12
- end
13
- end
@@ -1,42 +0,0 @@
1
- class String
2
- class << self
3
- # Build a url/human-friendly random string. Defaults to 25 characters long.
4
- def friendly(length = 25)
5
- (1..length).map{ friendly_characters.sample }.join
6
- end
7
-
8
- # Build a completely unfriendly random string. Defaults to 25 characters long.
9
- def crazy(length = 25)
10
- (1..length).map{ crazy_characters.sample }.join
11
- end
12
-
13
- private
14
-
15
- def friendly_characters
16
- @friendly_characters ||= ['0'..'9', 'a'..'z', 'A'..'Z'].map(&:to_a).flatten!
17
- end
18
-
19
- def crazy_characters
20
- @crazy_characters ||= friendly_characters + ["\\", '(', ')', ' ', '`', '#', '"', "'", '?'] +
21
- %w(~ ! @ $ % ^ & * _ - + = [ ] { } | ; : , < . > /)
22
- end
23
- end
24
-
25
- # Translate a human-readable representation of an ObjectID instance back to an ObjectID.
26
- # Requires the all-your-base gem.
27
- def to_oid
28
- string = ::AllYourBase::Are.convert_to_base_10(self, :radix => 62).to_s(16)
29
-
30
- # replace leading zeroes that were lost during the hex conversion
31
- until string.length == 24
32
- string = '0' + string
33
- end
34
-
35
- BSON::ObjectID.from_string(string.reverse)
36
- end
37
-
38
- # For when you want to check for a string in a case-insensitive fashion. Mostly used in Mongo queries.
39
- def to_regex
40
- /^#{Regexp.escape(self)}$/i
41
- end
42
- end
@@ -1,17 +0,0 @@
1
- class Time
2
- # Simplify time range checking
3
- # time = 10.minutes.from_now
4
- # time.within? 5.minutes # "of right now" is implied
5
- # => false
6
- # time.within? 20.minutes
7
- # => true
8
- # time.within? 1.minute, :of => 12.minutes.from_now
9
- # => false
10
- # time.within? 5.minutes, :of => 12.minutes.from_now
11
- # => true
12
- def within?(period, options = {})
13
- comparison_point = options[:of] || Time.now
14
- time_difference = (comparison_point - self).abs
15
- time_difference < period
16
- end
17
- end