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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6aab77ba17a5345e1eb6a60f6a5a5db7306df7eb
4
- data.tar.gz: ee2a0f808ec2fc3febb13259bbaf0aded5630fd9
2
+ SHA256:
3
+ metadata.gz: 964e287156e79b56d6b6210bf1b7a5934e38e6178352904e23c7d8d84206a193
4
+ data.tar.gz: 3d6648046d0ecb62ec85da53f102910a07c7ddd855bc0174ee2507baca328fba
5
5
  SHA512:
6
- metadata.gz: 88ef238dc777b031cd082a570484c2be65b1b47f35dcf689bf0093fe2e6895f4404adbbe327541eb2e45fb0d09707bbf4cfa21ef0a343ee1b415139dfda65e9b
7
- data.tar.gz: da92237c03e285e2c516aff46fb94a54c5019f123924ac16389b2bc567ebdcf57f04f2fc49f3af72dcb0c70c1da4317efeb9c30c2ad7a0a4a0a0e58442b89e62
6
+ metadata.gz: a45e2802db6fe67fe7adb3e3d7690142b994c0548fecf2fdbf21b04c1bf95a54d69db4272d60c0926578070b961f82c3faf71e828db8dfc8b857b11b992744ed
7
+ data.tar.gz: d49000f0bcc7ccb7677a953d8a3788fcacbd9b9f6e94c5863d55111c2eb244af26b88c112c01f3504835dca011fabe9d6a365e3e91bd1b4d94c0fce14554baf2
data/.travis.yml CHANGED
@@ -2,9 +2,10 @@ sudo: false
2
2
  language: ruby
3
3
 
4
4
  rvm:
5
- - 2.2
6
- - 2.1
7
- - rbx-2
5
+ - ruby-head
6
+ - 2.7
7
+ - 2.6
8
+ - 2.5
8
9
  - jruby-head
9
10
  - jruby-9000
10
11
 
data/CHANGELOG.md CHANGED
@@ -1,6 +1,27 @@
1
- ## CHANGELOG
1
+ # Changelog
2
2
 
3
- ### 0.1.0
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 (0.1.0)
5
- colorize (~> 0.7)
6
- thor (~> 0.19)
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.7.7)
12
- diff-lcs (1.2.5)
13
- rake (10.4.2)
14
- rspec (3.3.0)
15
- rspec-core (~> 3.3.0)
16
- rspec-expectations (~> 3.3.0)
17
- rspec-mocks (~> 3.3.0)
18
- rspec-core (3.3.2)
19
- rspec-support (~> 3.3.0)
20
- rspec-expectations (3.3.1)
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.3.0)
23
- rspec-mocks (3.3.2)
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.3.0)
26
- rspec-support (3.3.0)
27
- thor (0.19.1)
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 (~> 10.0)
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
@@ -3,7 +3,6 @@ require_relative 'set'
3
3
 
4
4
  module Stroop
5
5
  class CLI < Thor
6
-
7
6
  DEFAULT_SIZE = 5.freeze
8
7
 
9
8
  desc 'neutral COLSxROWS', 'prints neutral color words in COLS columns and ROWS rows'
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
- wrap(space * (total_word_width * columns))
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
- space + line + space
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.on_light_black
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
- end
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
@@ -1,5 +1,5 @@
1
1
  module Stroop
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
4
4
 
5
5
 
@@ -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.1'
20
+ gem.required_ruby_version = '~> 2.5'
21
21
 
22
- gem.add_runtime_dependency 'colorize', '~> 0.7'
23
- gem.add_runtime_dependency 'thor', '~> 0.19'
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', '~> 10.0'
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: 0.1.0
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: 2015-11-07 00:00:00.000000000 Z
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.7'
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.7'
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.19'
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.19'
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: '10.0'
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: '10.0'
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.1'
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
- rubyforge_project:
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