squarify 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 4f4d571459abafa26b7e53d4da2df4cd296d1ec591e0891f196ff1f6646e4369
4
- data.tar.gz: 1b8158f13d23b657bb112a691a9ae96004ef46da67ae987ddaa6b11472b67eb4
3
+ metadata.gz: a53cdb3666adabad8ebe6b4d5c88bef27dff7886ddbb8a40559f4f9adfa1493e
4
+ data.tar.gz: 89291a990ae279c8ee267fc98f2237b5be135cf868e41bec52958344aeba3743
5
5
  SHA512:
6
- metadata.gz: 889a259eb25a2c915e0c8dcdc3b38889994ec2e6d7e2c821be05eb1158fb841375a38853015621011e6875974ae20f20926f20a1eb6225df01bd36d269aa97be
7
- data.tar.gz: c8f8f53c08fd7bcbe1271999a4ba7ac96f282acb7255df0a82b443d49c3012243aaa4b277410205b05b018f90392e27f9a5e3b98efbacdbd6bc7dd3bcea1dc85
6
+ metadata.gz: 8bc5f0ecaaad508e3e73fbd7b197b3889549795523c6e1154ac54dc458f3eab712a849aa50ed279784f85f710151c7a53c35cc009482bcc45e23c3f4fa116a76
7
+ data.tar.gz: 85e871b50f7cf69c02a64821593c422d7f51852e3622e198d34667bf2a9931c34f7b172ce4ddf6c66582db8962b920c309fdc1cdffd35769a0ca89cb2fa3945f
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.4
2
+ TargetRubyVersion: 2.6
3
3
 
4
4
  Style/StringLiterals:
5
5
  Enabled: true
@@ -11,3 +11,7 @@ Style/StringLiteralsInInterpolation:
11
11
 
12
12
  Layout/LineLength:
13
13
  Max: 120
14
+
15
+ Metrics/BlockLength:
16
+ Exclude:
17
+ - 'spec/**/*'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2021-05-26
3
+ ## [0.1.4] - 2021-05-26
4
+
5
+ - Changes to pass rubucop's tests
4
6
 
5
- - Initial release
data/Gemfile.lock ADDED
@@ -0,0 +1,55 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ squarify (0.1.4)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ ast (2.4.2)
10
+ diff-lcs (1.4.4)
11
+ parallel (1.20.1)
12
+ parser (3.0.1.1)
13
+ ast (~> 2.4.1)
14
+ rainbow (3.0.0)
15
+ rake (13.0.3)
16
+ regexp_parser (2.1.1)
17
+ rexml (3.2.5)
18
+ rspec (3.10.0)
19
+ rspec-core (~> 3.10.0)
20
+ rspec-expectations (~> 3.10.0)
21
+ rspec-mocks (~> 3.10.0)
22
+ rspec-core (3.10.1)
23
+ rspec-support (~> 3.10.0)
24
+ rspec-expectations (3.10.1)
25
+ diff-lcs (>= 1.2.0, < 2.0)
26
+ rspec-support (~> 3.10.0)
27
+ rspec-mocks (3.10.2)
28
+ diff-lcs (>= 1.2.0, < 2.0)
29
+ rspec-support (~> 3.10.0)
30
+ rspec-support (3.10.2)
31
+ rubocop (1.15.0)
32
+ parallel (~> 1.10)
33
+ parser (>= 3.0.0.0)
34
+ rainbow (>= 2.2.2, < 4.0)
35
+ regexp_parser (>= 1.8, < 3.0)
36
+ rexml
37
+ rubocop-ast (>= 1.5.0, < 2.0)
38
+ ruby-progressbar (~> 1.7)
39
+ unicode-display_width (>= 1.4.0, < 3.0)
40
+ rubocop-ast (1.7.0)
41
+ parser (>= 3.0.1.1)
42
+ ruby-progressbar (1.11.0)
43
+ unicode-display_width (2.0.0)
44
+
45
+ PLATFORMS
46
+ ruby
47
+
48
+ DEPENDENCIES
49
+ rake (~> 13.0)
50
+ rspec (~> 3.0)
51
+ rubocop (~> 1.7)
52
+ squarify!
53
+
54
+ BUNDLED WITH
55
+ 2.1.4
data/lib/squarify.rb CHANGED
@@ -2,50 +2,50 @@
2
2
 
3
3
  require_relative "squarify/version"
4
4
 
5
-
6
5
  module Squarify
6
+ # This module contains the Squarify classes
7
+ class Console
8
+ # This class allows formatting text like a ticket
9
+ attr_reader :stdout, :size, :record
7
10
 
8
- class Console
9
- attr_reader :stdout, :size, :record
10
- def initialize size, record = false
11
- @size = size
12
- @record = record
13
- @stdout = "" if record
14
- end
15
-
16
- def line options = nil
17
- box "━" * (@size - 2), options
18
- end
19
-
20
- def text sentence, options = nil
21
- if options.eql? "center"
22
- sentence = truncate(sentence.center(@size - 2), @size - 2)
23
- else
24
- sentence = truncate(sentence, @size - 2)
25
- sentence = sentence + " " * (@size - sentence.length - 2)
26
- end
27
-
28
- @stdout += sentence + "\n" if @record
29
- box sentence, options
30
- end
31
-
32
- private
33
- def box sentence, options
34
- case options
35
- when "top"
36
- line = "┏" + sentence + "┓"
37
- when "bottom"
38
- line = "┗" + sentence + "┛"
39
- when "middle"
40
- line = "┣" + sentence + "┫"
41
- else
42
- line = "┃" + sentence + "┃"
43
- end
44
- end
45
-
46
- def truncate(string, max)
47
- string.length > max ? "#{string[0...max - 3]}..." : string
48
- end
11
+ def initialize(size, record: false)
12
+ @size = size
13
+ @record = record
14
+ @stdout = "" if record
15
+ end
16
+
17
+ def line(options: nil)
18
+ box "━" * (@size - 2), options
19
+ end
20
+
21
+ def text(sentence, options = nil)
22
+ if options.eql? "center"
23
+ sentence = truncate(sentence.center(@size - 2), @size - 2)
24
+ else
25
+ sentence = truncate(sentence, @size - 2)
26
+ sentence += " " * (@size - sentence.length - 2)
27
+ end
28
+ @stdout += "#{sentence}\n" if @record
29
+ box sentence, options
49
30
  end
50
- end
51
31
 
32
+ private
33
+
34
+ def box(sentence, options)
35
+ case options
36
+ when "top"
37
+ "┏#{sentence}┓"
38
+ when "bottom"
39
+ "┗#{sentence}┛"
40
+ when "middle"
41
+ "┣#{sentence}┫"
42
+ else
43
+ "┃#{sentence}┃"
44
+ end
45
+ end
46
+
47
+ def truncate(string, max)
48
+ string.length > max ? "#{string[0...max - 3]}..." : string
49
+ end
50
+ end
51
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squarify
4
- VERSION = "0.1.3"
4
+ VERSION = "0.1.4"
5
5
  end
data/squarify.gemspec CHANGED
@@ -10,9 +10,9 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "Converts text to square like format"
12
12
  spec.description = "It takes strings and converts them to a format that is nicer to print out in logs"
13
- spec.homepage = "https://github.com/mauroniewolskicesca/squarify"
13
+ spec.homepage = "https://github.com/mauroniewolskicesca/squarify"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/mauroniewolskicesca/squarify"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squarify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mauro Niewolski
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-26 00:00:00.000000000 Z
11
+ date: 2021-05-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: It takes strings and converts them to a format that is nicer to print
14
14
  out in logs
@@ -23,6 +23,7 @@ files:
23
23
  - ".rubocop.yml"
24
24
  - CHANGELOG.md
25
25
  - Gemfile
26
+ - Gemfile.lock
26
27
  - LICENSE.txt
27
28
  - README.md
28
29
  - Rakefile
@@ -46,14 +47,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
47
  requirements:
47
48
  - - ">="
48
49
  - !ruby/object:Gem::Version
49
- version: 2.4.0
50
+ version: 2.6.0
50
51
  required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  requirements:
52
53
  - - ">="
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  requirements: []
56
- rubygems_version: 3.0.3
57
+ rubygems_version: 3.1.6
57
58
  signing_key:
58
59
  specification_version: 4
59
60
  summary: Converts text to square like format