gruff 0.29.0 → 0.30.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
2
  SHA256:
3
- metadata.gz: 79572698484a762e000b269890c2575523d452453fc6a00d5e6302acae126c89
4
- data.tar.gz: 06a6b5e010af0c354bbc9547b594ea6e3412f3f30662d985c3bcb7143cb92fbf
3
+ metadata.gz: 75e12531ea04a32fe92c5d2eb922eee2b4464c266a7291fca8b50a3aaf772aeb
4
+ data.tar.gz: b5ad337b9e726f30ab9dbcf97612d83fb32e0842a788e9d1ce427a53b0d8ff3a
5
5
  SHA512:
6
- metadata.gz: 0c557571a807ac8157c8f43401514374a052e61c1b22482169c9baf8b5b1c686b715fe222bd7d838118e33e536cdf2cf4639c75a0e5d21c8ab268993dc457ef8
7
- data.tar.gz: 22ccb5f2c70327d30c8de0cafb13d9f1ec05d13b53cfef37a27e9a3d23b66f8009d13c90dc12425dcf460bf518d84eca2cff3140028629916be70964af928592
6
+ metadata.gz: f98f73af84275229589343c3e5dc8a7ca0aca73f044cfd918bfcd3efb3c7072ae6e04d307061c8ac7ed33c3c9221bc588505ee6dc737c083d61263aeca32e46c
7
+ data.tar.gz: 9ec8af554b9ddc3d6dbcdb99742aeffa4b4574b8a5800883058fa80951991cf3192a875f70372cd3a151b10b5528cfa5fb1bc49406cef41986e92cc06ed8e21b
@@ -0,0 +1,6 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: 'github-actions'
4
+ directory: '/'
5
+ schedule:
6
+ interval: 'monthly'
@@ -15,16 +15,16 @@ jobs:
15
15
  timeout-minutes: 20
16
16
  strategy:
17
17
  matrix:
18
- ruby-version: ['3.4']
18
+ ruby-version: ['4.0']
19
19
  imagemagick-version:
20
- - { full: 7.1.1-33, major-minor: '7.1' }
20
+ - { full: 7.1.2-10, major-minor: '7.1' }
21
21
  name: Lint (Ruby ${{ matrix.ruby-version }}, ImageMagick ${{ matrix.imagemagick-version.major-minor }})
22
22
  steps:
23
- - uses: actions/checkout@v4
23
+ - uses: actions/checkout@v6
24
24
  with:
25
25
  ref: ${{ github.event.pull_request.head.sha }}
26
26
  - name: Cache ImageMagick
27
- uses: actions/cache@v4
27
+ uses: actions/cache@v5
28
28
  with:
29
29
  path: ./build-ImageMagick
30
30
  key: v1-linux-imagemagick-${{ matrix.imagemagick-version.full }}
@@ -35,12 +35,10 @@ jobs:
35
35
  export IMAGEMAGICK_VERSION=${{ matrix.imagemagick-version.full }}
36
36
  ./before_install_linux.sh
37
37
  - name: Set up Ruby ${{ matrix.ruby-version }}
38
- uses: ruby/setup-ruby@master
38
+ uses: ruby/setup-ruby@v1
39
39
  with:
40
40
  ruby-version: ${{ matrix.ruby-version }}
41
41
  bundler-cache: true
42
- - name: Install dependencies
43
- run: bundle install --path=vendor/bundle --jobs 4 --retry 3
44
42
  - name: RuboCop Problem Matchers
45
43
  uses: r7kamura/rubocop-problem-matchers-action@v1
46
44
  - name: Run tests
@@ -51,16 +49,16 @@ jobs:
51
49
  timeout-minutes: 20
52
50
  strategy:
53
51
  matrix:
54
- ruby-version: ['3.4']
52
+ ruby-version: ['4.0']
55
53
  imagemagick-version:
56
- - { full: 7.1.1-33, major-minor: '7.1' }
54
+ - { full: 7.1.2-10, major-minor: '7.1' }
57
55
  name: Check RBS (Ruby ${{ matrix.ruby-version }}, ImageMagick ${{ matrix.imagemagick-version.major-minor }})
58
56
  steps:
59
- - uses: actions/checkout@v4
57
+ - uses: actions/checkout@v6
60
58
  with:
61
59
  ref: ${{ github.event.pull_request.head.sha }}
62
60
  - name: Cache ImageMagick
63
- uses: actions/cache@v4
61
+ uses: actions/cache@v5
64
62
  with:
65
63
  path: ./build-ImageMagick
66
64
  key: v1-linux-imagemagick-${{ matrix.imagemagick-version.full }}
@@ -71,12 +69,10 @@ jobs:
71
69
  export IMAGEMAGICK_VERSION=${{ matrix.imagemagick-version.full }}
72
70
  ./before_install_linux.sh
73
71
  - name: Set up Ruby ${{ matrix.ruby-version }}
74
- uses: ruby/setup-ruby@master
72
+ uses: ruby/setup-ruby@v1
75
73
  with:
76
74
  ruby-version: ${{ matrix.ruby-version }}
77
75
  bundler-cache: true
78
- - name: Install dependencies
79
- run: bundle install --path=vendor/bundle --jobs 4 --retry 3
80
76
  - name: Run tests
81
77
  run: |
82
78
  bundle exec rake rbs:update
@@ -87,15 +83,16 @@ jobs:
87
83
  runs-on: ubuntu-24.04
88
84
  timeout-minutes: 20
89
85
  strategy:
86
+ fail-fast: false
90
87
  matrix:
91
- ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4']
88
+ ruby-version: ['3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
92
89
  imagemagick-version:
93
- - { full: 7.1.1-33, major-minor: '7.1' }
90
+ - { full: 7.1.2-10, major-minor: '7.1' }
94
91
  name: Ruby ${{ matrix.ruby-version }}
95
92
  steps:
96
- - uses: actions/checkout@v4
93
+ - uses: actions/checkout@v6
97
94
  - name: Cache ImageMagick
98
- uses: actions/cache@v4
95
+ uses: actions/cache@v5
99
96
  with:
100
97
  path: ./build-ImageMagick
101
98
  key: v1-linux-imagemagick-${{ matrix.imagemagick-version.full }}
@@ -106,12 +103,10 @@ jobs:
106
103
  export IMAGEMAGICK_VERSION=${{ matrix.imagemagick-version.full }}
107
104
  ./before_install_linux.sh
108
105
  - name: Set up Ruby
109
- uses: ruby/setup-ruby@master
106
+ uses: ruby/setup-ruby@v1
110
107
  with:
111
108
  ruby-version: ${{ matrix.ruby-version }}
112
- bundler-cache: false
113
- - name: Install dependencies
114
- run: bundle install --path=vendor/bundle --jobs 4 --retry 3
109
+ bundler-cache: true
115
110
  - name: Run tests
116
111
  run: bundle exec rake
117
112
 
@@ -123,13 +118,11 @@ jobs:
123
118
  ruby-version: ['9.4.7.0']
124
119
  name: JRuby ${{ matrix.ruby-version }}
125
120
  steps:
126
- - uses: actions/checkout@v4
121
+ - uses: actions/checkout@v6
127
122
  - name: Set up Ruby
128
- uses: ruby/setup-ruby@master
123
+ uses: ruby/setup-ruby@v1
129
124
  with:
130
125
  ruby-version: jruby-${{ matrix.ruby-version }}
131
126
  bundler-cache: true
132
- - name: Install dependencies
133
- run: bundle install --path=vendor/bundle --jobs 4 --retry 3
134
127
  - name: Run tests
135
128
  run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  plugins:
2
4
  - rubocop-minitest
3
5
  - rubocop-performance
@@ -84,6 +86,9 @@ Style/ConstantVisibility:
84
86
  Style/Copyright:
85
87
  Enabled: false
86
88
 
89
+ Style/OneClassPerFile:
90
+ Enabled: false
91
+
87
92
  Style/Documentation:
88
93
  Enabled: true
89
94
 
@@ -117,6 +122,9 @@ Style/MethodCallWithArgsParentheses:
117
122
  Style/MissingElse:
118
123
  Enabled: false
119
124
 
125
+ Style/NegativeArrayIndex:
126
+ Enabled: false
127
+
120
128
  Style/Next:
121
129
  Enabled: false
122
130
 
@@ -126,6 +134,9 @@ Style/NumericPredicate:
126
134
  Style/OptionHash:
127
135
  Enabled: false
128
136
 
137
+ Style/CollectionQuerying:
138
+ Enabled: false
139
+
129
140
  Style/RedundantBegin:
130
141
  Enabled: false
131
142
 
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,17 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-03-29 02:09:03 UTC using RuboCop version 1.86.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 726
10
+ # Configuration parameters: EnforcedStyle, Visibility.
11
+ # SupportedStyles: doc_style, doc_style_and_return_annotation, method_type_signature, method_type_signature_or_return_annotation
12
+ Style/RbsInline/MissingTypeAnnotation:
13
+ Enabled: false
14
+
15
+ # Offense count: 193
16
+ Style/RbsInline/UntypedInstanceVariable:
17
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.30.0
4
+
5
+ - RBS: Add missing signatures (#674)
6
+ - Candlestick: Fix graph width calculation (#671)
7
+
3
8
  ## 0.29.0
4
9
 
5
10
  - Line graph: reset previous point between dataxy series to prevent unwanted poly‑line connection (#665)
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  source 'https://rubygems.org'
4
5
 
@@ -12,6 +13,7 @@ unless defined? JRUBY_VERSION
12
13
  gem 'rubocop-rake', '~> 0.6'
13
14
  end
14
15
 
16
+ gem 'minitest', '~> 5.0'
15
17
  gem 'minitest-reporters'
16
18
  gem 'rake'
17
19
  gem 'simplecov'
data/gruff.gemspec CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  lib = File.expand_path('lib')
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
data/init.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  # For Rails
4
5
  require 'gruff'
@@ -81,7 +81,7 @@ private
81
81
  minimum_value: minimum_value, maximum_value: maximum_value, spread: @spread
82
82
  )
83
83
 
84
- width = (@graph_width - calculate_spacing) / column_count
84
+ width = @graph_width / calculate_spacing
85
85
  bar_width = width * @spacing_factor
86
86
  padding = width - bar_width
87
87
 
@@ -115,9 +115,9 @@ private
115
115
  normalized_candlesticks.size
116
116
  end
117
117
 
118
- # @rbs return: Integer
118
+ # @rbs return: Float
119
119
  def calculate_spacing
120
- column_count - 1
120
+ column_count.to_f
121
121
  end
122
122
 
123
123
  # @rbs return: bool
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  #
4
5
  # Makes a small bar graph suitable for display at 200px or even smaller.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  # A module to handle the small legend.
4
5
  # @private
@@ -95,7 +96,7 @@ module Gruff::Mini::Legend
95
96
  font.size = scale(font.size)
96
97
  max_width = @columns - scale(x_offset) - @right_margin
97
98
  while calculate_width(font, "#{truncated_label}...") > max_width && truncated_label.length > 1
98
- truncated_label = truncated_label[0..truncated_label.length - 2]
99
+ truncated_label = truncated_label[0..(truncated_label.length - 2)]
99
100
  end
100
101
  truncated_label + (truncated_label.length < label.to_s.length ? '...' : '')
101
102
  # steep:ignore:end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  #
4
5
  # Makes a small pie graph suitable for display at 200px or even smaller.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  #
4
5
  # Makes a small side bar graph suitable for display at 200px or even smaller.
data/lib/gruff/net.rb CHANGED
@@ -98,7 +98,7 @@ private
98
98
  return if @hide_line_markers
99
99
 
100
100
  # Draw horizontal line markers and annotate with numbers
101
- (0..column_count - 1).each do |index|
101
+ (0..(column_count - 1)).each do |index|
102
102
  rad_pos = index * Math::PI * 2 / column_count
103
103
 
104
104
  Gruff::Renderer::Line.new(renderer, color: @marker_color)
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  # @private
4
5
  module Magick
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  # @private
4
5
  module String::GruffCommify
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # rbs_inline: enabled
2
3
 
3
4
  module Gruff
4
5
  # @private
data/lib/gruff/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  # rbs_inline: enabled
4
4
 
5
5
  module Gruff
6
- VERSION = '0.29.0'
6
+ VERSION = '0.30.0'
7
7
  end
@@ -58,8 +58,8 @@ class Gruff::Candlestick < Gruff::Base
58
58
  # @rbs return: Integer
59
59
  def column_count: () -> Integer
60
60
 
61
- # @rbs return: Integer
62
- def calculate_spacing: () -> Integer
61
+ # @rbs return: Float
62
+ def calculate_spacing: () -> Float
63
63
 
64
64
  # @rbs return: bool
65
65
  def show_marker_vertical_line?: () -> bool
@@ -0,0 +1,24 @@
1
+ # Generated from lib/gruff/mini/bar.rb with RBS::Inline
2
+
3
+ #
4
+ # Makes a small bar graph suitable for display at 200px or even smaller.
5
+ #
6
+ # Here's how to set up a Gruff::Mini::Bar.
7
+ #
8
+ # g = Gruff::Mini::Bar.new
9
+ # g.title = 'Mini Bar Graph'
10
+ # g.data :Art, [0, 5, 8, 15]
11
+ # g.data :Philosophy, [10, 3, 2, 8]
12
+ # g.data :Science, [2, 15, 8, 11]
13
+ # g.write('mini_bar.png')
14
+ class Gruff::Mini::Bar < Gruff::Bar
15
+ private
16
+
17
+ include Gruff::Mini::Legend
18
+
19
+ def initialize_attributes: () -> untyped
20
+
21
+ def setup_data: () -> untyped
22
+
23
+ def draw_graph: () -> untyped
24
+ end
@@ -0,0 +1,26 @@
1
+ # Generated from lib/gruff/mini/legend.rb with RBS::Inline
2
+
3
+ # A module to handle the small legend.
4
+ # @private
5
+ module Gruff::Mini::Legend
6
+ attr_accessor hide_mini_legend: untyped
7
+
8
+ attr_accessor legend_position: untyped
9
+
10
+ def initialize: (*untyped) -> untyped
11
+
12
+ # The canvas needs to be bigger so we can put the legend beneath it.
13
+ def expand_canvas_for_vertical_legend: () -> untyped
14
+
15
+ def calculate_line_height: () -> untyped
16
+
17
+ def calculate_legend_width: () -> untyped
18
+
19
+ # Draw the legend beneath the existing graph.
20
+ def draw_vertical_legend: () -> untyped
21
+
22
+ # Shorten long labels so they will fit on the canvas.
23
+ def truncate_legend_label: (untyped label, untyped x_offset) -> untyped
24
+
25
+ def scale: (untyped value) -> untyped
26
+ end
@@ -0,0 +1,23 @@
1
+ # Generated from lib/gruff/mini/pie.rb with RBS::Inline
2
+
3
+ #
4
+ # Makes a small pie graph suitable for display at 200px or even smaller.
5
+ #
6
+ # Here's how to set up a Gruff::Mini::Pie.
7
+ #
8
+ # g = Gruff::Mini::Pie.new
9
+ # g.title = "Visual Pie Graph Test"
10
+ # g.data 'Fries', 20
11
+ # g.data 'Hamburgers', 50
12
+ # g.write("mini_pie_keynote.png")
13
+ class Gruff::Mini::Pie < Gruff::Pie
14
+ private
15
+
16
+ include Gruff::Mini::Legend
17
+
18
+ def initialize_attributes: () -> untyped
19
+
20
+ def setup_data: () -> untyped
21
+
22
+ def draw_graph: () -> untyped
23
+ end
@@ -0,0 +1,31 @@
1
+ # Generated from lib/gruff/mini/side_bar.rb with RBS::Inline
2
+
3
+ #
4
+ # Makes a small side bar graph suitable for display at 200px or even smaller.
5
+ #
6
+ # Here's how to set up a Gruff::Mini::SideBar.
7
+ #
8
+ # g = Gruff::Mini::SideBar.new
9
+ # g.title = 'SideBar Graph'
10
+ # g.labels = {
11
+ # 0 => '5/6',
12
+ # 1 => '5/15',
13
+ # 2 => '5/24',
14
+ # 3 => '5/30',
15
+ # }
16
+ # g.group_spacing = 20
17
+ # g.data :Art, [0, 5, 8, 15]
18
+ # g.data :Philosophy, [10, 3, 2, 8]
19
+ # g.data :Science, [2, 15, 8, 11]
20
+ # g.write('mini_sidebar.png')
21
+ class Gruff::Mini::SideBar < Gruff::SideBar
22
+ private
23
+
24
+ include Gruff::Mini::Legend
25
+
26
+ def initialize_attributes: () -> untyped
27
+
28
+ def setup_data: () -> untyped
29
+
30
+ def draw_graph: () -> untyped
31
+ end
@@ -0,0 +1,15 @@
1
+ # Generated from lib/gruff/patch/rmagick.rb with RBS::Inline
2
+
3
+ # @private
4
+ module Magick
5
+ # @private
6
+ module GruffAnnotate
7
+ # Additional method to scale annotation text since Draw.scale doesn't.
8
+ def annotate_scaled: (untyped img, untyped width, untyped height, untyped x, untyped y, untyped text, untyped scale) -> untyped
9
+
10
+ # FIXME(uwe): We should NOT need to implement this method.
11
+ # Remove this method as soon as RMagick4J Issue #16 is fixed.
12
+ # https://github.com/Serabe/RMagick4J/issues/16
13
+ def fill=: (untyped fill) -> untyped
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ # Generated from lib/gruff/patch/string.rb with RBS::Inline
2
+
3
+ # @private
4
+ module String::GruffCommify
5
+ THOUSAND_SEPARATOR: ::String
6
+
7
+ # Taken from http://codesnippets.joyent.com/posts/show/330
8
+ def commify: (?untyped delimiter) -> untyped
9
+ end
@@ -0,0 +1,16 @@
1
+ # Generated from lib/gruff/renderer/polygon.rb with RBS::Inline
2
+
3
+ module Gruff
4
+ # @private
5
+ class Renderer::Polygon
6
+ # @rbs renderer: Gruff::Renderer
7
+ # @rbs color: String
8
+ # @rbs width: Float | Integer
9
+ # @rbs opacity: Float | Integer
10
+ # @rbs return: void
11
+ def initialize: (Gruff::Renderer renderer, color: String, ?width: Float | Integer, ?opacity: Float | Integer) -> void
12
+
13
+ # @rbs points: Array[Float | Integer]
14
+ def render: (Array[Float | Integer] points) -> untyped
15
+ end
16
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gruff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Geoffrey Grosenbach
@@ -63,9 +63,11 @@ files:
63
63
  - ".editorconfig"
64
64
  - ".github/ISSUE_TEMPLATE.md"
65
65
  - ".github/ISSUE_TEMPLATE/report.yml"
66
+ - ".github/dependabot.yml"
66
67
  - ".github/workflows/ci.yml"
67
68
  - ".gitignore"
68
69
  - ".rubocop.yml"
70
+ - ".rubocop_todo.yml"
69
71
  - ".yardopts"
70
72
  - CHANGELOG.md
71
73
  - Gemfile
@@ -146,7 +148,13 @@ files:
146
148
  - sig/generated/gruff/helper/stacked_mixin.rbs
147
149
  - sig/generated/gruff/histogram.rbs
148
150
  - sig/generated/gruff/line.rbs
151
+ - sig/generated/gruff/mini/bar.rbs
152
+ - sig/generated/gruff/mini/legend.rbs
153
+ - sig/generated/gruff/mini/pie.rbs
154
+ - sig/generated/gruff/mini/side_bar.rbs
149
155
  - sig/generated/gruff/net.rbs
156
+ - sig/generated/gruff/patch/rmagick.rbs
157
+ - sig/generated/gruff/patch/string.rbs
150
158
  - sig/generated/gruff/pie.rbs
151
159
  - sig/generated/gruff/renderer/bezier.rbs
152
160
  - sig/generated/gruff/renderer/circle.rbs
@@ -154,6 +162,7 @@ files:
154
162
  - sig/generated/gruff/renderer/dot.rbs
155
163
  - sig/generated/gruff/renderer/ellipse.rbs
156
164
  - sig/generated/gruff/renderer/line.rbs
165
+ - sig/generated/gruff/renderer/polygon.rbs
157
166
  - sig/generated/gruff/renderer/polyline.rbs
158
167
  - sig/generated/gruff/renderer/rectangle.rbs
159
168
  - sig/generated/gruff/renderer/renderer.rbs
@@ -191,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
200
  - !ruby/object:Gem::Version
192
201
  version: '0'
193
202
  requirements: []
194
- rubygems_version: 3.7.0
203
+ rubygems_version: 3.6.9
195
204
  specification_version: 4
196
205
  summary: Beautiful graphs for one or multiple datasets.
197
206
  test_files: []