stroop 0.1.0 → 1.0.0
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 +5 -5
- data/.travis.yml +4 -3
- data/CHANGELOG.md +23 -2
- data/Gemfile.lock +22 -19
- data/lib/stroop/cli.rb +0 -1
- data/lib/stroop/set.rb +22 -12
- data/lib/stroop/version.rb +1 -1
- data/spec/stroop/set_spec.rb +5 -5
- data/stroop.gemspec +4 -4
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 964e287156e79b56d6b6210bf1b7a5934e38e6178352904e23c7d8d84206a193
|
4
|
+
data.tar.gz: 3d6648046d0ecb62ec85da53f102910a07c7ddd855bc0174ee2507baca328fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a45e2802db6fe67fe7adb3e3d7690142b994c0548fecf2fdbf21b04c1bf95a54d69db4272d60c0926578070b961f82c3faf71e828db8dfc8b857b11b992744ed
|
7
|
+
data.tar.gz: d49000f0bcc7ccb7677a953d8a3788fcacbd9b9f6e94c5863d55111c2eb244af26b88c112c01f3504835dca011fabe9d6a365e3e91bd1b4d94c0fce14554baf2
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,27 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
|
-
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
## [1.0.0] - 2020-05-21
|
11
|
+
### Removed
|
12
|
+
- Drop support for Ruby <= v2.4
|
13
|
+
|
14
|
+
### Fixed
|
15
|
+
- Color displaying for the word panel
|
16
|
+
- Ensure same colors do not appear multiple times in one row
|
17
|
+
|
18
|
+
### Security
|
19
|
+
- Dependency update to fix security issues with [Rake <= v12.3.2](https://github.com/advisories/GHSA-jppv-gw3r-w3q8)
|
20
|
+
|
21
|
+
## [0.1.0] - 2015-11-07
|
4
22
|
|
5
23
|
* Inital release
|
6
24
|
|
25
|
+
[Unreleased]: https://github.com/paulgoetze/stroop/compare/v1.0.0...HEAD
|
26
|
+
[1.0.0]: https://github.com/paulgoetze/stroop/compare/v0.1.0...v1.0.0
|
27
|
+
[0.1.0]: https://github.com/paulgoetze/stroop/releases/tag/v0.1.0
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stroop (
|
5
|
-
colorize (~> 0.
|
6
|
-
thor (~> 0
|
4
|
+
stroop (1.0.0)
|
5
|
+
colorize (~> 0.8)
|
6
|
+
thor (~> 1.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
colorize (0.
|
12
|
-
diff-lcs (1.
|
13
|
-
rake (
|
14
|
-
rspec (3.
|
15
|
-
rspec-core (~> 3.
|
16
|
-
rspec-expectations (~> 3.
|
17
|
-
rspec-mocks (~> 3.
|
18
|
-
rspec-core (3.
|
19
|
-
rspec-support (~> 3.3
|
20
|
-
rspec-expectations (3.
|
11
|
+
colorize (0.8.1)
|
12
|
+
diff-lcs (1.3)
|
13
|
+
rake (13.0.1)
|
14
|
+
rspec (3.9.0)
|
15
|
+
rspec-core (~> 3.9.0)
|
16
|
+
rspec-expectations (~> 3.9.0)
|
17
|
+
rspec-mocks (~> 3.9.0)
|
18
|
+
rspec-core (3.9.2)
|
19
|
+
rspec-support (~> 3.9.3)
|
20
|
+
rspec-expectations (3.9.2)
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.
|
23
|
-
rspec-mocks (3.
|
22
|
+
rspec-support (~> 3.9.0)
|
23
|
+
rspec-mocks (3.9.1)
|
24
24
|
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
-
rspec-support (~> 3.
|
26
|
-
rspec-support (3.3
|
27
|
-
thor (0.
|
25
|
+
rspec-support (~> 3.9.0)
|
26
|
+
rspec-support (3.9.3)
|
27
|
+
thor (1.0.1)
|
28
28
|
|
29
29
|
PLATFORMS
|
30
30
|
ruby
|
31
31
|
|
32
32
|
DEPENDENCIES
|
33
|
-
rake (~>
|
33
|
+
rake (~> 13.0)
|
34
34
|
rspec (~> 3.0)
|
35
35
|
stroop!
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
2.1.4
|
data/lib/stroop/cli.rb
CHANGED
data/lib/stroop/set.rb
CHANGED
@@ -3,8 +3,7 @@ require_relative 'exceptions'
|
|
3
3
|
|
4
4
|
module Stroop
|
5
5
|
class Set
|
6
|
-
|
7
|
-
COLORS = %w{ black white red green blue yellow }
|
6
|
+
COLORS = %w{ black white red green blue yellow }.freeze
|
8
7
|
|
9
8
|
NEUTRAL = :neutral
|
10
9
|
CONGRUENT = :congruent
|
@@ -12,6 +11,15 @@ module Stroop
|
|
12
11
|
|
13
12
|
MODES = [NEUTRAL, CONGRUENT, INCONGRUENT].freeze
|
14
13
|
|
14
|
+
BOX = {
|
15
|
+
vertical: "┊",
|
16
|
+
horizontal: "┄",
|
17
|
+
top_left: "┌",
|
18
|
+
top_right: "┐",
|
19
|
+
bottom_left: "└",
|
20
|
+
bottom_right: "┘"
|
21
|
+
}.transform_values(&:light_black).freeze
|
22
|
+
|
15
23
|
attr_reader :rows, :columns, :mode
|
16
24
|
|
17
25
|
def initialize(rows:, columns:, mode:)
|
@@ -23,13 +31,17 @@ module Stroop
|
|
23
31
|
end
|
24
32
|
|
25
33
|
def to_s
|
26
|
-
[empty_line, *lines, empty_line].join("\n")
|
34
|
+
[empty_line(:top), *lines, empty_line(:bottom)].join("\n")
|
27
35
|
end
|
28
36
|
|
29
37
|
private
|
30
38
|
|
31
|
-
def empty_line
|
32
|
-
|
39
|
+
def empty_line(location)
|
40
|
+
corner_left = BOX[:"#{location}_left"]
|
41
|
+
line = BOX[:horizontal] * (total_word_width * columns)
|
42
|
+
corner_right = BOX[:"#{location}_right"]
|
43
|
+
|
44
|
+
corner_left + line + corner_right
|
33
45
|
end
|
34
46
|
|
35
47
|
def lines
|
@@ -42,12 +54,12 @@ module Stroop
|
|
42
54
|
end
|
43
55
|
|
44
56
|
def wrap(line)
|
45
|
-
|
57
|
+
BOX[:vertical] + line + BOX[:vertical]
|
46
58
|
end
|
47
59
|
|
48
60
|
def random_word
|
49
61
|
word, color = word_color_pair
|
50
|
-
word.center(total_word_width).send(color).bold
|
62
|
+
word.center(total_word_width).send(color).bold
|
51
63
|
end
|
52
64
|
|
53
65
|
def word_color_pair
|
@@ -77,11 +89,9 @@ module Stroop
|
|
77
89
|
end
|
78
90
|
|
79
91
|
def random_color
|
80
|
-
COLORS.sample
|
81
|
-
|
82
|
-
|
83
|
-
def space
|
84
|
-
" ".on_light_black
|
92
|
+
color = COLORS.sample
|
93
|
+
color = random_color if color == @latest_random_color
|
94
|
+
@latest_random_color = color
|
85
95
|
end
|
86
96
|
|
87
97
|
def max_word_length
|
data/lib/stroop/version.rb
CHANGED
data/spec/stroop/set_spec.rb
CHANGED
@@ -3,20 +3,20 @@ require 'spec_helper'
|
|
3
3
|
describe Stroop::Set do
|
4
4
|
|
5
5
|
let(:arguments) { {rows: 1, columns: 2, mode: :neutral } }
|
6
|
-
subject { described_class.new(arguments) }
|
6
|
+
subject { described_class.new(**arguments) }
|
7
7
|
|
8
8
|
describe 'creating a new instance' do
|
9
9
|
it 'should raise an error if the given mode is not available' do
|
10
10
|
expect {
|
11
|
-
described_class.new(arguments.merge({ mode: :not_existing }))
|
11
|
+
described_class.new(**arguments.merge({ mode: :not_existing }))
|
12
12
|
}.to raise_error Stroop::SetModeNotAvailable
|
13
13
|
end
|
14
14
|
|
15
15
|
it 'should not raise an error if the given mode is available' do
|
16
16
|
expect {
|
17
|
-
described_class.new(arguments.merge({ mode: :neutral }))
|
18
|
-
described_class.new(arguments.merge({ mode: :congruent }))
|
19
|
-
described_class.new(arguments.merge({ mode: :incongruent }))
|
17
|
+
described_class.new(**arguments.merge({ mode: :neutral }))
|
18
|
+
described_class.new(**arguments.merge({ mode: :congruent }))
|
19
|
+
described_class.new(**arguments.merge({ mode: :incongruent }))
|
20
20
|
}.not_to raise_error
|
21
21
|
end
|
22
22
|
end
|
data/stroop.gemspec
CHANGED
@@ -17,11 +17,11 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ['lib']
|
19
19
|
|
20
|
-
gem.required_ruby_version = '~> 2.
|
20
|
+
gem.required_ruby_version = '~> 2.5'
|
21
21
|
|
22
|
-
gem.add_runtime_dependency 'colorize', '~> 0.
|
23
|
-
gem.add_runtime_dependency 'thor', '~> 0
|
22
|
+
gem.add_runtime_dependency 'colorize', '~> 0.8'
|
23
|
+
gem.add_runtime_dependency 'thor', '~> 1.0'
|
24
24
|
|
25
25
|
gem.add_development_dependency 'rspec', '~> 3.0'
|
26
|
-
gem.add_development_dependency 'rake', '~>
|
26
|
+
gem.add_development_dependency 'rake', '~> 13.0'
|
27
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stroop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Götze
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.8'
|
20
20
|
type: :runtime
|
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: '0.
|
26
|
+
version: '0.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
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: '0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '13.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '13.0'
|
69
69
|
description: The Stroop effect - demonstrating the interference in the reaction time
|
70
70
|
of a task.
|
71
71
|
email: paul.christoph.goetze@gmail.com
|
@@ -105,15 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
105
|
requirements:
|
106
106
|
- - "~>"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '2.
|
108
|
+
version: '2.5'
|
109
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.4.3
|
115
|
+
rubygems_version: 3.0.3
|
117
116
|
signing_key:
|
118
117
|
specification_version: 4
|
119
118
|
summary: Stroop effect
|