ternary_types 0.0.1 → 0.1.0

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
- SHA1:
3
- metadata.gz: 46426cac759835696bc9fd7ec9c4e4d23f613ecd
4
- data.tar.gz: e1414aaf0aa2c9ea97d1cccf559ef3faa9e14d9a
2
+ SHA256:
3
+ metadata.gz: 4796a8e1450139d4f0ed1af856f350618449ba4019b2748209aea4b9b70efc49
4
+ data.tar.gz: a62aea643d113e100639f24955d668d34926e0dca3d1d5ab2fc2a404f6382a90
5
5
  SHA512:
6
- metadata.gz: ec4d8cc6e150e22d29beb0bd8a3c932d5d25c9fb4fd412fc1d3001b3d0b334a6292bb0838c5a1868ea088c1b1739100f7d40e90feb22bbe282114a12fcb67a96
7
- data.tar.gz: af929f5704333e80db9a3eb4141af2432dadf3e8d92d64521594e2a0ae881162cf559852f307551cd001bca0e916af792998075df968876bf1431e4f692762d6
6
+ metadata.gz: 23bec1031f6a0cd32b45c6faff4a92f218e91e308302c872a11bde11591b68b2336c97bd8498d5142258822117d5cd1f2432fb43dcce8c247d56b4b6c2d4b180
7
+ data.tar.gz: 463c9f6e2e1de82d59a79256ff753743f9c40c5189d2064ee4e33f787ee017082cf3da8ff9fb69c3fb8ecd66d2625178704e94aaa81ecf8b81490a497bcbdd05
data/README.md CHANGED
@@ -9,11 +9,11 @@ require 'ternary_types'
9
9
 
10
10
  T = TernaryTypes::True.instance
11
11
  M = TernaryTypes::Maybe.instance
12
- F = TernaryTypes::Flase.instance
12
+ F = TernaryTypes::False.instance
13
13
 
14
14
  !T # => #<TernaryTypes::False:0x007feccc7c4938>
15
15
  !M # => #<TernaryTypes::Maybe:0x007feccc7b61f8>
16
- T == F # => #<TernaryTypes::True:0x007feccc7bc670>
16
+ T == F # => #<TernaryTypes::False:0x007feccc7c4938>
17
17
  M == T # => #<TernaryTypes::Maybe:0x007feccc7b61f8>
18
18
  M == M # => #<TernaryTypes::Maybe:0x007feccc7b61f8>
19
19
  T == T # => #<TernaryTypes::True:0x007feccc7bc670>
@@ -1,3 +1,3 @@
1
1
  module TernaryTypes
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/ternary_types.rb CHANGED
@@ -6,14 +6,10 @@ module TernaryTypes
6
6
  module_function
7
7
 
8
8
  def Ternary(value)
9
- if [True, False, Maybe].any?{|c| value.is_a?(c)}
10
- value
11
- elsif value == :maybe
12
- Maybe.instance
13
- elsif value
14
- True.instance
15
- else
16
- False.instance
9
+ case value
10
+ when True, False, Maybe; value
11
+ when nil, false; False.instance
12
+ else; True.instance
17
13
  end
18
14
  end
19
15
  end
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
20
  spec.require_paths = ["lib"]
21
21
 
22
- spec.add_development_dependency "bundler", "~> 1.7"
23
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "rake"
24
+ spec.add_development_dependency "minitest"
24
25
  end
@@ -2,7 +2,7 @@ require 'bundler/setup'
2
2
  require 'minitest/autorun'
3
3
  require 'ternary_types'
4
4
 
5
- class TernaryTypesTest < MiniTest::Unit::TestCase
5
+ class TernaryTypesTest < MiniTest::Test
6
6
  T = TernaryTypes::True.instance
7
7
  F = TernaryTypes::False.instance
8
8
  M = TernaryTypes::Maybe.instance
@@ -94,7 +94,7 @@ class TernaryTypesTest < MiniTest::Unit::TestCase
94
94
  assert_true Ternary(T), 'Ternary(T)'
95
95
  assert_maybe Ternary(M), 'Ternary(M)'
96
96
  assert_false Ternary(F), 'Ternary(F)'
97
- assert_maybe Ternary(:maybe), 'Ternary(:maybe)'
97
+ assert_true Ternary(:maybe), 'Ternary(:maybe)'
98
98
  assert_true Ternary(:object), 'Ternary(:object)'
99
99
  assert_false Ternary(false), 'Ternary(false)'
100
100
  assert_false Ternary(nil), 'Ternary(nil)'
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ternary_types
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Chernyak
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-28 00:00:00.000000000 Z
11
+ date: 2023-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.7'
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.7'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Provides ternary singletons True, False, and Maybe with ==,!,&,|,^ operators
42
56
  implemented according to three-value logic.
43
57
  email:
@@ -59,7 +73,7 @@ homepage: https://github.com/maxim/ternary_types
59
73
  licenses:
60
74
  - MIT
61
75
  metadata: {}
62
- post_install_message:
76
+ post_install_message:
63
77
  rdoc_options: []
64
78
  require_paths:
65
79
  - lib
@@ -74,11 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  requirements: []
77
- rubyforge_project:
78
- rubygems_version: 2.4.5
79
- signing_key:
91
+ rubygems_version: 3.4.2
92
+ signing_key:
80
93
  specification_version: 4
81
94
  summary: Use ternary types in your ruby apps.
82
95
  test_files:
83
96
  - test/ternary_types_test.rb
84
- has_rdoc: