true_string 0.0.1 → 0.0.2

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: c190502fb37d78d1c8ab3938339e14eaf6b04969
4
- data.tar.gz: d2ed21a9b1bb2d539646890560747b0c844fe542
3
+ metadata.gz: f501320bc3f0d78799ec13188ac0905096d19e1c
4
+ data.tar.gz: 88e7f0ca283fd81dbbbe518155ba39e553003c39
5
5
  SHA512:
6
- metadata.gz: 25adeb7c675468495f894bd9bc44f85991bf4cccc23402a77086c57917ab4e48e39b0135dc6a4240a70eed939c7530e1c515bd772236a97d2af366a1e7cb4ed5
7
- data.tar.gz: ff5bdc9970ba1f6b60dab94c3069de3437065ee21c4a85a728c332ce68c6d499871e4372fcfd96452b0388563864045a0dbcf4dee6abb2f51da82ace0eda52c6
6
+ metadata.gz: debf85516bc4b68b58af00b5a2c11a1379f6fd2df7760c7f2e32aeb162d21e10089f4d1f1f7b4e5a9b8d3b0b435d1411dd3d0b89c2538746f239136aca4cce5a
7
+ data.tar.gz: a3262ce2816bb9a8c542dff774ba7ce77d9636012e1aa9bbf1d3ce05268a63b18cabb00164d2044b6cc2156d51163bfaaa94ccadacc8ac908edcd7780e9645d6
data/README.md CHANGED
@@ -16,6 +16,15 @@ Collection of strings which can be translated into truth values, `true` and `fal
16
16
 
17
17
  An string can not return `true` for both `#truthy?` and `#falsey?`, but may return `false` for both of them.
18
18
 
19
+ `Object` also has `truthy?` and `falsey?`.
20
+
21
+ ```rb
22
+ Object.truthy?
23
+ nil.falsey?
24
+ ```
25
+
26
+ The methods returns `true` if the receiver is truthy or falsey respectively.
27
+
19
28
  ## Installation
20
29
 
21
30
  Add this line to your application's Gemfile:
@@ -6,15 +6,18 @@ module TrueString
6
6
  pairs = [
7
7
  %w(true false),
8
8
  %w(TRUE FALSE),
9
+ %w(True False),
9
10
  %w(t f),
10
11
  %w(T F),
11
12
  %w(1 0),
12
13
  %w(yes no),
13
14
  %w(YES NO),
15
+ %w(Yes No),
14
16
  %w(y n),
15
17
  %w(Y N),
16
18
  %w(on off),
17
19
  %w(ON OFF),
20
+ %w(On Off),
18
21
  %w(○ ×),
19
22
  %w(⭕️ ❌),
20
23
  %w(✅ ❎),
@@ -41,3 +44,13 @@ class String
41
44
  TrueString::TRUTH_TABLE[self] == false
42
45
  end
43
46
  end
47
+
48
+ class Object
49
+ def truthy?
50
+ !!self
51
+ end
52
+
53
+ def falsey?
54
+ !self
55
+ end
56
+ end
@@ -1,3 +1,3 @@
1
1
  module TrueString
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: true_string
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-21 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler