finishing_moves 0.17 → 0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1828abea212796a7805b0a15e1363ac078904cc3
4
- data.tar.gz: 7c178f430b1ebb14f1ca202681af98ede8e279de
3
+ metadata.gz: ea386064f3ddd76587cfc19a0f3fa451bc5df6fe
4
+ data.tar.gz: 68de87aee88555b846024b4edcbad5a6872c3f64
5
5
  SHA512:
6
- metadata.gz: c0d721dc93276daf8ad46b3aa9ebac6994144b9f588457c04e3301ddc813ed2052effd2442b831b94487453bc2551f7de2406607368d04f035a6d4a210b6bd52
7
- data.tar.gz: d8d2005ed176acbc765fac2423170e78b9e8e9cd3bfbf5c8da6e60517ce50f362807a4f08be6a8a1391ed8c55a74c386e5042c4c10224380f6618219214cf005
6
+ metadata.gz: 2577531144756e18069014d715f319e3512e028840ae6a255de0bd0c51816c6714613cfaba67379c08316b36ec3d96266d8625473d2c2b6ebc7ecacbb3ae1ebb
7
+ data.tar.gz: be79b56034b36aadb87fd36f1a35156134be6aef557d35a14c4d9f6f499d4fe4e9ba68977fe584754797bb73dff61b36bf3f4372d5bd033a576e2d42c9f4e13f
data/README.md CHANGED
@@ -19,7 +19,7 @@ Command line
19
19
  gem install 'finishing_moves'
20
20
  ```
21
21
 
22
- ## Functionality
22
+ ## Documentation
23
23
 
24
24
  **Not sure if this gem is for you?** Check out the methods marked with a :boom: first.
25
25
 
@@ -44,11 +44,14 @@ gem install 'finishing_moves'
44
44
  - [`Object#true?`](https://github.com/forgecrafted/finishing_moves/wiki/Object#objecttruefalsebool)
45
45
  - [`Object#false?`](https://github.com/forgecrafted/finishing_moves/wiki/Object#objecttruefalsebool)
46
46
  - [`Object#bool?`](https://github.com/forgecrafted/finishing_moves/wiki/Object#objecttruefalsebool)
47
+ - [`Object#true_?`](https://github.com/forgecrafted/finishing_moves/wiki/Object#objecttrue_-objectfalse_)
48
+ - [`Object#false_?`](https://github.com/forgecrafted/finishing_moves/wiki/Object#objecttrue_-objectfalse_)
47
49
  - [`String#dedupe`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringdedupe)
48
50
  - [`String#keyify`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringkeyify)
49
51
  - [`String#slugify`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringslugify)
50
52
  - [`String#match?`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringmatch)
51
53
  - [`String#nl2br`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnl2br)
54
+ - [`String#newline_to`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnewline_to)
52
55
  - [`String#numeric?`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringnumeric) :boom:
53
56
  - [`String#remove_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringremove_whitespace)
54
57
  - [`String#replace_whitespace`](https://github.com/forgecrafted/finishing_moves/wiki/String#stringreplace_whitespace)
@@ -24,4 +24,16 @@ class Hash
24
24
  return self
25
25
  end
26
26
 
27
+ # auto-nesting hashes
28
+ # https://dzone.com/articles/create-nested-hashes-ruby
29
+ # Goal:
30
+ # a = {}
31
+ # a[2][1] = 2
32
+ # a[2][2][3] = 4
33
+ # a[3][1][1][1] = 1
34
+ def Hash.new_nested_hash
35
+ Hash.new{ |h,k| h[k] = Hash.new(&h.default_proc) }
36
+ end
37
+
38
+
27
39
  end
@@ -45,6 +45,16 @@ class Object
45
45
  return false
46
46
  end
47
47
 
48
+ def false_?
49
+ raise "value is not a boolean class (#{self.class.name})" if !bool?
50
+ false?
51
+ end
52
+
53
+ def true_?
54
+ raise "value is not a boolean class (#{self.class.name})" if !bool?
55
+ true?
56
+ end
57
+
48
58
  def is_one_of?( *klasses )
49
59
  klasses.each do |klass|
50
60
  return true if is_a? klass
@@ -1,3 +1,3 @@
1
1
  module FinishingMoves
2
- VERSION = "0.17"
2
+ VERSION = "0.18"
3
3
  end
@@ -83,4 +83,27 @@ describe Object do
83
83
  expect(:symbol.is_one_of? String, Float, Object).to eq true
84
84
  end
85
85
 
86
+ it "#true_?" do
87
+ expect(true.true_?).to eq true
88
+ expect(false.true_?).to eq false
89
+ expect{ nil.true_? }.to raise_error(RuntimeError)
90
+ expect{ 1.true_? }.to raise_error(RuntimeError)
91
+ expect{ [:ar, :ray].true_? }.to raise_error(RuntimeError)
92
+ expect{ {ha: :sh}.true_? }.to raise_error(RuntimeError)
93
+ expect{ 'string'.true_? }.to raise_error(RuntimeError)
94
+ expect{ :symbol.true_? }.to raise_error(RuntimeError)
95
+ end
96
+
97
+ it "#false_?" do
98
+ expect(false.false_?).to eq true
99
+ expect(true.false_?).to eq false
100
+ expect{ nil.false_? }.to raise_error(RuntimeError)
101
+ expect{ 0.false_? }.to raise_error(RuntimeError)
102
+ expect{ [:ar, :ray].false_? }.to raise_error(RuntimeError)
103
+ expect{ {ha: :sh}.false_? }.to raise_error(RuntimeError)
104
+ expect{ 'string'.false_? }.to raise_error(RuntimeError)
105
+ expect{ :symbol.false_? }.to raise_error(RuntimeError)
106
+ end
107
+
108
+
86
109
  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.17'
4
+ version: '0.18'
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: 2017-01-23 00:00:00.000000000 Z
12
+ date: 2017-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rb-readline