syllogism 0.2.1 → 0.2.2

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
  SHA256:
3
- metadata.gz: 6ad005a2e8bd7ddc588c2560ce9909beabe56596d768887ce4b859e7c6a3ee20
4
- data.tar.gz: 44d9c5fa05434ba543be9b2ac30e6a424f58d7339b91156272dccd17788b5adb
3
+ metadata.gz: 26dd7a01178ea39e1474914a56f16b4f903b302acda0f78d662000c137b85a00
4
+ data.tar.gz: 6a657acaef3ec4485eedd43ca25f3d649e6657eb0f80233b86c1649f405b36bd
5
5
  SHA512:
6
- metadata.gz: f86543e5b34a1039a6fcb45540c67495724095859c39713d838258613d2bfaaaa0ac1f8b06046bb8821902fe817b3d78ae29fcba4472509478b9f301d0ae8fdb
7
- data.tar.gz: 191175b76be5a5ef38c900de8dfe9dc800575325361fb5d8affbb39386294e009f7efc8b27844dc6cf04162093f1f806556336fe5738f2d2a43f428ffacc4db1
6
+ metadata.gz: c1d328e06496620c3a660f69694a46f7071ffc75df431220a5775a77cb96f50d87f2436c7aeea0fd7ffd73a5efac454d93230c933dfe482135aba180ea129f50
7
+ data.tar.gz: 3f3a1de1da37f1e8f74f0495c865cac13fd858734ec6ec38067fa54c42f0493c1196779f5b37ab9550c25c80251a4c6f1d390903b8cc03d5bbd4d0566f387fce
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.0.2
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syllogism (0.2.1)
4
+ syllogism (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.4.4)
9
+ diff-lcs (1.5.0)
10
10
  rake (12.3.3)
11
- rspec (3.10.0)
12
- rspec-core (~> 3.10.0)
13
- rspec-expectations (~> 3.10.0)
14
- rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.1)
16
- rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.1)
11
+ rspec (3.12.0)
12
+ rspec-core (~> 3.12.0)
13
+ rspec-expectations (~> 3.12.0)
14
+ rspec-mocks (~> 3.12.0)
15
+ rspec-core (3.12.0)
16
+ rspec-support (~> 3.12.0)
17
+ rspec-expectations (3.12.0)
18
18
  diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.10.0)
20
- rspec-mocks (3.10.2)
19
+ rspec-support (~> 3.12.0)
20
+ rspec-mocks (3.12.0)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.10.0)
23
- rspec-support (3.10.2)
22
+ rspec-support (~> 3.12.0)
23
+ rspec-support (3.12.0)
24
24
 
25
25
  PLATFORMS
26
26
  ruby
data/README.md CHANGED
@@ -42,6 +42,10 @@ argument = Syllogism["all A is B", "some C is A", "some C is B"]
42
42
  other_argument = Syllogism["all X is Y", "some Z is X", "some Z is Y"]
43
43
 
44
44
  argument == other_argument # => true
45
+
46
+ # Generate random argument
47
+ Syllogism.sample.statements.map(&:to_s)
48
+ => ["all M is C", "no L is M", "some L is C"]
45
49
  ```
46
50
 
47
51
  ## Development
@@ -6,6 +6,6 @@ class Syllogism
6
6
 
7
7
  private
8
8
 
9
- GENERAL_TERM_VALUES = ("A".."Z").freeze
9
+ GENERAL_TERM_VALUES = ("A".."Z")
10
10
  end
11
11
  end
@@ -6,6 +6,6 @@ class Syllogism
6
6
 
7
7
  private
8
8
 
9
- SINGULAR_TERM_VALUES = ("a".."z").freeze
9
+ SINGULAR_TERM_VALUES = ("a".."z")
10
10
  end
11
11
  end
@@ -1,3 +1,3 @@
1
1
  class Syllogism
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
data/lib/syllogism.rb CHANGED
@@ -25,6 +25,24 @@ class Syllogism
25
25
  new(raw_statements.map { |raw_statement| Statement.parse(raw_statement) })
26
26
  end
27
27
 
28
+ def self.random_statement(letter, other_letter)
29
+ case (1..4).to_a.sample
30
+ when 1 then "all #{letter} is #{other_letter}"
31
+ when 2 then "no #{letter} is #{other_letter}"
32
+ when 3 then "some #{letter} is #{other_letter}"
33
+ when 4 then "some #{letter} is #{other_letter}"
34
+ end
35
+ end
36
+
37
+ def self.sample
38
+ first, second, third = ("A".."Z").to_a.sample(3)
39
+ parse(
40
+ random_statement(first, second),
41
+ random_statement(third, first),
42
+ random_statement(third, second)
43
+ )
44
+ end
45
+
28
46
  def initialize(statements)
29
47
  @errors = []
30
48
  @statements = statements
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syllogism
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Virissimo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-02 00:00:00.000000000 Z
11
+ date: 2022-11-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Proof checker for arguments in Aristotle's term logic
14
14
  email:
@@ -20,6 +20,7 @@ files:
20
20
  - ".github/workflows/test.yml"
21
21
  - ".gitignore"
22
22
  - ".rspec"
23
+ - ".tool-versions"
23
24
  - Gemfile
24
25
  - Gemfile.lock
25
26
  - LICENSE.txt
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  - !ruby/object:Gem::Version
68
69
  version: '0'
69
70
  requirements: []
70
- rubygems_version: 3.0.3
71
+ rubygems_version: 3.3.5
71
72
  signing_key:
72
73
  specification_version: 4
73
74
  summary: Proof checker for arguments in Aristotle's term logic