finishing_moves 0.9 → 0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 866fccad1318171c982abbbfa77150f2df07cae9
4
- data.tar.gz: 8fca63c081718015c790a23e6f4c5a31c3b8c34c
3
+ metadata.gz: 8fa39013ba6ec17c497a103c1f3da47fe3430254
4
+ data.tar.gz: 303ecf554a58c32cd118763113866203b6994abe
5
5
  SHA512:
6
- metadata.gz: 2bc558724c3c8be629cad4657abc66629e6bd6004b892b29c3263ab4b7ce385eee6436ea67212a42cdfcf07233feb39d0984d5e63f94af6651092fd79effe0d0
7
- data.tar.gz: 65e3f054b09fc2dffc6088e25129b4471024cbd1b6e5fce1d2e672db8209ce5ec72417a2d8ea44ddec32ed985d955334605b2265a369275e53f822fc866fdf6a
6
+ metadata.gz: f1e1f5cf13031d01880e3291ddf69c3ed3d7f1a92488f2176f056e7f8eed987f099894fd8b25b494c579d43dfab338df8410e7f25cb446ac3ff4172c03d073ce
7
+ data.tar.gz: 450954afe04c6e6db894c12a46d441fdcceb67b1e2252977e0b43d2018c1a753deab7128576ed6ef90629666c70942309401cb6bcfd4da25050603776fe2b2d0
data/README.md CHANGED
@@ -53,6 +53,7 @@ Tested against **`2.0.0` and above**. Probably works in `1.9.3`.
53
53
  - [`String#slugify`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringslugify)
54
54
  - [`String#match?`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringmatch)
55
55
  - [`String#nl2br`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnl2br)
56
+ - [`String#numeric?`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnumeric) :boom:
56
57
  - [`String#remove_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringremove_whitespace)
57
58
  - [`String#strip_all`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringstrip_all) :boom:
58
59
 
@@ -30,4 +30,26 @@ class Object
30
30
  name.slugify
31
31
  end
32
32
 
33
+ def false?
34
+ return true if self.is_a? FalseClass
35
+ return false
36
+ end
37
+
38
+ def true?
39
+ return true if self.is_a? TrueClass
40
+ return false
41
+ end
42
+
43
+ def bool?
44
+ return true if self.is_one_of? TrueClass, FalseClass
45
+ return false
46
+ end
47
+
48
+ def is_one_of?( *klasses )
49
+ klasses.each do |klass|
50
+ return true if is_a? klass
51
+ end
52
+ return false
53
+ end
54
+
33
55
  end
@@ -1,3 +1,3 @@
1
1
  module FinishingMoves
2
- VERSION = "0.9"
2
+ VERSION = "0.10"
3
3
  end
data/spec/object_spec.rb CHANGED
@@ -37,4 +37,50 @@ describe Object do
37
37
  expect(a.is_not_an?(Hash)).to eq true
38
38
  end
39
39
 
40
+ it "#true?" do
41
+ expect(true.true?).to eq true
42
+ expect(false.true?).to eq false
43
+ expect(nil.true?).to eq false
44
+ expect([:ar, :ray].true?).to eq false
45
+ expect({ha: :sh}.true?).to eq false
46
+ expect('string'.true?).to eq false
47
+ expect(:symbol.true?).to eq false
48
+ end
49
+
50
+ it "#false?" do
51
+ expect(false.false?).to eq true
52
+ expect(true.false?).to eq false
53
+ expect(nil.false?).to eq false
54
+ expect([:ar, :ray].false?).to eq false
55
+ expect({ha: :sh}.false?).to eq false
56
+ expect('string'.false?).to eq false
57
+ expect(:symbol.false?).to eq false
58
+ end
59
+
60
+ it "#bool?" do
61
+ expect(true.bool?).to eq true
62
+ expect(false.bool?).to eq true
63
+ expect(nil.bool?).to eq false
64
+ expect('string'.bool?).to eq false
65
+ expect(:symbol.bool?).to eq false
66
+ expect(1.bool?).to eq false
67
+ expect(0.bool?).to eq false
68
+ end
69
+
70
+ it "#is_one_of?" do
71
+ expect(nil.is_one_of? NilClass).to eq true
72
+ expect(nil.is_one_of? TrueClass, FalseClass, NilClass).to eq true
73
+ expect(nil.is_one_of? TrueClass, FalseClass).to eq false
74
+ expect(1.is_one_of? Integer, String).to eq true
75
+ expect('1'.is_one_of? Integer, String).to eq true
76
+ expect('1'.is_one_of? Integer, Float).to eq false
77
+ expect(1.1.is_one_of? Integer, Float).to eq true
78
+ expect(1.1.is_one_of? String, Float).to eq true
79
+ expect('1.1'.is_one_of? String, Float).to eq true
80
+ expect(:symbol.is_one_of? String, Symbol, Float).to eq true
81
+ expect(:symbol.is_one_of? String, Float).to eq false
82
+ expect(:symbol.is_one_of? String, Symbol).to eq true
83
+ expect(:symbol.is_one_of? String, Float, Object).to eq true
84
+ end
85
+
40
86
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finishing_moves
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.9'
4
+ version: '0.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank Koehl
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-04-29 00:00:00.000000000 Z
12
+ date: 2016-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-readline