duck_puncher 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/lib/duck_puncher/object.rb +9 -0
- data/lib/duck_puncher/version.rb +1 -1
- data/lib/duck_puncher.rb +17 -6
- data/test/duck_puncher/array_test.rb +3 -4
- data/test/duck_puncher/hash_test.rb +3 -4
- data/test/duck_puncher/numeric_test.rb +4 -4
- data/test/duck_puncher/object_test.rb +10 -0
- data/test/duck_puncher/string_test.rb +3 -4
- data/test/test_helper.rb +4 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82d81798a5571df6798f22fb5992e6661bfaed33
|
4
|
+
data.tar.gz: 4149ee3e005d014077302a4cdb58e66919a5dace
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be39db7e9786c8e26ffb380da1d104692699b2d15521acb3ff149284ee13aabdb6b3e4de55a98528a681ee6d67cedd828de148da6f4932f3e192e7252301d65b
|
7
|
+
data.tar.gz: abd91da05a36d4679d99d0710e0749b122159613dbb110366f3a26f3e83d9155fcfc03f7e78bfe27d8a4c3d7f73801fcc4aa4280dc2c9147d0ff1f7411465fb0
|
data/Rakefile
CHANGED
data/lib/duck_puncher/version.rb
CHANGED
data/lib/duck_puncher.rb
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
require 'duck_puncher/version'
|
2
|
-
require 'duck_puncher/array'
|
3
|
-
require 'duck_puncher/numeric'
|
4
|
-
require 'duck_puncher/hash'
|
5
|
-
require 'duck_puncher/string'
|
6
2
|
|
7
3
|
module DuckPuncher
|
8
|
-
|
4
|
+
autoload :Array, 'duck_puncher/array'
|
5
|
+
autoload :Numeric, 'duck_puncher/numeric'
|
6
|
+
autoload :Hash, 'duck_puncher/hash'
|
7
|
+
autoload :String, 'duck_puncher/string'
|
8
|
+
autoload :Object, 'duck_puncher/object'
|
9
|
+
|
10
|
+
if defined? ActiveRecord
|
11
|
+
autoload :ActiveRecordExtensions, 'duck_puncher/active_record_extensions'
|
12
|
+
end
|
9
13
|
|
10
|
-
|
14
|
+
def self.load!(*names)
|
15
|
+
names.each &method(:const_get)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.load_all!
|
19
|
+
constants.each &method(:const_get)
|
20
|
+
end
|
21
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
require 'duck_puncher'
|
1
|
+
require_relative '../test_helper'
|
3
2
|
|
4
|
-
class ArrayTest < MiniTest::
|
3
|
+
class ArrayTest < MiniTest::Test
|
5
4
|
def test_m
|
6
5
|
samples = ('a'..'m').to_a
|
7
6
|
assert_equal samples.map(&:upcase), samples.m(:upcase)
|
@@ -11,4 +10,4 @@ class ArrayTest < MiniTest::Unit::TestCase
|
|
11
10
|
assert_equal [].methods.get(/ty\?/), [:empty?]
|
12
11
|
assert_equal [].methods.get('ty?'), [:empty?]
|
13
12
|
end
|
14
|
-
end
|
13
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
require 'duck_puncher'
|
1
|
+
require_relative '../test_helper'
|
3
2
|
|
4
|
-
class HashTest < MiniTest::
|
3
|
+
class HashTest < MiniTest::Test
|
5
4
|
def test_seek
|
6
5
|
my_hash = { a: 1, b: { c: 2 } }
|
7
6
|
assert_equal my_hash.seek(:a), 1
|
@@ -9,4 +8,4 @@ class HashTest < MiniTest::Unit::TestCase
|
|
9
8
|
assert_equal my_hash.seek(:b, :c), 2
|
10
9
|
assert_equal my_hash.seek(:b), { c: 2 }
|
11
10
|
end
|
12
|
-
end
|
11
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative '../test_helper'
|
2
|
+
|
3
|
+
class NumericTest < MiniTest::Test
|
3
4
|
|
4
|
-
class NumericTest < MiniTest::Unit::TestCase
|
5
5
|
def test_to_currency
|
6
6
|
assert_equal '0.00', 0.to_currency
|
7
7
|
assert_equal '25.00', 25.to_currency
|
@@ -44,4 +44,4 @@ class NumericTest < MiniTest::Unit::TestCase
|
|
44
44
|
assert_equal '1 day ago', 100_000.to_time_ago
|
45
45
|
assert_equal '2 days ago', 180_000.to_time_ago
|
46
46
|
end
|
47
|
-
end
|
47
|
+
end
|
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
|
-
require 'duck_puncher'
|
1
|
+
require_relative '../test_helper'
|
3
2
|
|
4
|
-
class
|
3
|
+
class StringTest < MiniTest::Test
|
5
4
|
def test_pluralize
|
6
5
|
assert_equal 'hour'.pluralize(1), 'hour'
|
7
6
|
assert_equal 'hour'.pluralize(0), 'hours'
|
8
7
|
assert_equal 'hour'.pluralize(2), 'hours'
|
9
8
|
end
|
10
|
-
end
|
9
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: duck_puncher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -56,12 +56,15 @@ files:
|
|
56
56
|
- lib/duck_puncher/array.rb
|
57
57
|
- lib/duck_puncher/hash.rb
|
58
58
|
- lib/duck_puncher/numeric.rb
|
59
|
+
- lib/duck_puncher/object.rb
|
59
60
|
- lib/duck_puncher/string.rb
|
60
61
|
- lib/duck_puncher/version.rb
|
61
62
|
- test/duck_puncher/array_test.rb
|
62
63
|
- test/duck_puncher/hash_test.rb
|
63
64
|
- test/duck_puncher/numeric_test.rb
|
65
|
+
- test/duck_puncher/object_test.rb
|
64
66
|
- test/duck_puncher/string_test.rb
|
67
|
+
- test/test_helper.rb
|
65
68
|
homepage: ''
|
66
69
|
licenses:
|
67
70
|
- MIT
|
@@ -90,4 +93,6 @@ test_files:
|
|
90
93
|
- test/duck_puncher/array_test.rb
|
91
94
|
- test/duck_puncher/hash_test.rb
|
92
95
|
- test/duck_puncher/numeric_test.rb
|
96
|
+
- test/duck_puncher/object_test.rb
|
93
97
|
- test/duck_puncher/string_test.rb
|
98
|
+
- test/test_helper.rb
|