ruby-development-toolbox 1.1.0 → 1.2.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 +4 -4
- data/VERSION +1 -1
- data/lib/toolbox/gem_specification.rb +33 -0
- data/lib/toolbox/integer.rb +28 -0
- data/ruby-development-toolbox.gemspec +8 -5
- data/test/helper.rb +1 -1
- data/test/test_toolbox-integer.rb +29 -0
- metadata +6 -4
- data/test/test_ruby-development-toolbox.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc593164ca228f6c9e12669a9bdccf63076c1027
|
4
|
+
data.tar.gz: 1d438bb813b0001795937945c25986cc63a22dff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f89d2ec222286418d0f86e76499a8bc196494c0bf129b8e2528f2024fc06e13190dc7ed849ec2e3ae09d9535494aabd06b3ac4ee4ed1fdadd1085d2ffc99b5f5
|
7
|
+
data.tar.gz: 3dddabd8d56f360b9f6a9733b5881f94e0bdafb00d8fcc037760240e133278ab3d5200cefabb294f00a494616aec316ab299d5e5e9156a8c850b2655abd53081
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.2.0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Gem
|
2
|
+
class Specification
|
3
|
+
|
4
|
+
##
|
5
|
+
# Provides retrieving only the latest versions of all gems on
|
6
|
+
# your system regardless of multiple versions of a gem installed.
|
7
|
+
#
|
8
|
+
def self.latest_versions
|
9
|
+
specs = Gem::Specification.find_all.map.inject({}) do |result, spec|
|
10
|
+
if result.has_key?(spec.name) && result[spec.name].version < spec.version
|
11
|
+
result[spec.name] = spec
|
12
|
+
elsif !result.has_key?(spec.name)
|
13
|
+
result[spec.name] = spec
|
14
|
+
end
|
15
|
+
result
|
16
|
+
end
|
17
|
+
specs.values
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# Extends the functionality of a Gem::Specification to be able to retrieve the latest version of gems
|
24
|
+
# currently on your system.
|
25
|
+
#
|
26
|
+
# == Usage
|
27
|
+
#
|
28
|
+
# Gem::Specification.latest_versions.each do |spec|
|
29
|
+
# puts "#{spec.name} (#{spec.version})"
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
module GemSpecification
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class String
|
2
|
+
|
3
|
+
##
|
4
|
+
# Adds the ability to check if String is an integer (both positive and negative values accepted)
|
5
|
+
#
|
6
|
+
def is_i?
|
7
|
+
!self.match(/^[-+]?[0-9]+$/).nil?
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
module Toolbox
|
13
|
+
|
14
|
+
##
|
15
|
+
# Extends the functionality of String to support checking if a String can be converted
|
16
|
+
# to an Integer
|
17
|
+
#
|
18
|
+
# == Usage
|
19
|
+
#
|
20
|
+
# ['-1', '0', '1', '1.0', 'one', '1 too many'].each do |test|
|
21
|
+
# puts "This can be converted to an Integer" if test.is_i?
|
22
|
+
# puts "This cannot be converted to an Integer" unless test.is_i?
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
module Integer
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -2,14 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: ruby-development-toolbox 1.2.0 ruby lib
|
5
6
|
|
6
7
|
Gem::Specification.new do |s|
|
7
8
|
s.name = "ruby-development-toolbox"
|
8
|
-
s.version = "1.
|
9
|
+
s.version = "1.2.0"
|
9
10
|
|
10
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
11
13
|
s.authors = ["Peter Salas"]
|
12
|
-
s.date = "2014-
|
14
|
+
s.date = "2014-04-30"
|
13
15
|
s.description = "A collection of useful utilities and libraries for Ruby development (not Rails)"
|
14
16
|
s.email = "psalas+github@gmail.com"
|
15
17
|
s.extra_rdoc_files = [
|
@@ -28,16 +30,17 @@ Gem::Specification.new do |s|
|
|
28
30
|
"VERSION",
|
29
31
|
"lib/ruby-development-toolbox.rb",
|
30
32
|
"lib/toolbox/boolean.rb",
|
33
|
+
"lib/toolbox/gem_specification.rb",
|
31
34
|
"lib/toolbox/hash_diff.rb",
|
35
|
+
"lib/toolbox/integer.rb",
|
32
36
|
"lib/toolbox/uuid.rb",
|
33
37
|
"ruby-development-toolbox.gemspec",
|
34
38
|
"test/helper.rb",
|
35
|
-
"test/
|
39
|
+
"test/test_toolbox-integer.rb"
|
36
40
|
]
|
37
41
|
s.homepage = "http://github.com/gradeawarrior/ruby-development-toolbox"
|
38
42
|
s.licenses = ["MIT"]
|
39
|
-
s.
|
40
|
-
s.rubygems_version = "2.0.14"
|
43
|
+
s.rubygems_version = "2.2.2"
|
41
44
|
s.summary = "Useful Ruby Development Toolbox"
|
42
45
|
|
43
46
|
if s.respond_to? :specification_version then
|
data/test/helper.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'helper'
|
2
|
+
require 'toolbox/integer'
|
3
|
+
|
4
|
+
class TestToolboxInteger < Test::Unit::TestCase
|
5
|
+
|
6
|
+
should 'String is a valid integer' do
|
7
|
+
(0..1000).each do |integer|
|
8
|
+
assert_equal true, integer.to_s.is_i?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
should 'String is a negative number' do
|
13
|
+
(-1000..0).each do |integer|
|
14
|
+
assert_equal true, integer.to_s.is_i?
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
should 'String is a double value' do
|
19
|
+
['1.0', '-1.0', '3.1415'].each do |double|
|
20
|
+
assert_equal false, double.is_i?
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
should 'String is not a number' do
|
25
|
+
['foo', 'bar', 'one', '1 another'].each do |string|
|
26
|
+
assert_equal false, string.is_i?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-development-toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Salas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoulda
|
@@ -114,11 +114,13 @@ files:
|
|
114
114
|
- VERSION
|
115
115
|
- lib/ruby-development-toolbox.rb
|
116
116
|
- lib/toolbox/boolean.rb
|
117
|
+
- lib/toolbox/gem_specification.rb
|
117
118
|
- lib/toolbox/hash_diff.rb
|
119
|
+
- lib/toolbox/integer.rb
|
118
120
|
- lib/toolbox/uuid.rb
|
119
121
|
- ruby-development-toolbox.gemspec
|
120
122
|
- test/helper.rb
|
121
|
-
- test/
|
123
|
+
- test/test_toolbox-integer.rb
|
122
124
|
homepage: http://github.com/gradeawarrior/ruby-development-toolbox
|
123
125
|
licenses:
|
124
126
|
- MIT
|
@@ -139,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
141
|
version: '0'
|
140
142
|
requirements: []
|
141
143
|
rubyforge_project:
|
142
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.2.2
|
143
145
|
signing_key:
|
144
146
|
specification_version: 4
|
145
147
|
summary: Useful Ruby Development Toolbox
|