more_math 1.0.0 → 1.0.1

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: 1a9d46106c13337d7b3b949a3984d57de664ba0f8f7931a4ac8aa91139e36a2b
4
- data.tar.gz: ce02a111f04c4bc8aab30603d172e47bae8f62bd500484a5ea9b20d2438cb5cd
3
+ metadata.gz: 1ba84f4d700f11ea528792c07fc7a1b44e055039336ffb9a9081f777637b7609
4
+ data.tar.gz: 1a783a0247589249a75b9a9475f2d6ebecf21e032c809841f066612191916809
5
5
  SHA512:
6
- metadata.gz: 44864c937a9f957f6aaf9a7fad4d5a300c75e4db9e69f882f1fc42ff07c9f811b405c70d7c0a8b312e698053aef63f787d26bb66a7b37f86c58c22e8bfcafdd2
7
- data.tar.gz: 9a0dfb7c53d2c1487cb2f8597268b921dfdb0898e3130ca894cb0222dad2a1ee2ee54d466c56ae51ddc17063d35a7b05dde4e3a3c6fa080e720eba0ae9a00d44
6
+ metadata.gz: 01cc841c484126edc0a5c407a20c9649b07cf3d2700115c0b8cc7829a26fc88b10663b68f4f8e05b35721a87ee9f77af296a0a7fb8e859700a543b2b191b4117
7
+ data.tar.gz: f5ab98072be38fab9f327eed3d7ed88b736c58bff92fb71957a779beba46d90ec36dba863fb68c4c9b351082d93b591af341bc77bbef9bda05627778a9e89407
@@ -36,6 +36,7 @@ module MoreMath
36
36
  # Display this histogram to +output+, +width+ is the parameter for
37
37
  # +prepare_display+
38
38
  def display(output = $stdout, width = 50)
39
+ width >= 1 or raise ArgumentError, "width needs to be >= 1"
39
40
  for r in rows
40
41
  output << output_row(r, width)
41
42
  end
@@ -56,8 +57,11 @@ module MoreMath
56
57
  else
57
58
  left_width = width
58
59
  end
60
+ if left_width < 0
61
+ left_width = width
62
+ end
59
63
  factor = left_width.to_f / max_count
60
- bar_width = (count * factor).ceil
64
+ bar_width = (count * factor).round
61
65
  bar = ?* * bar_width
62
66
  if @with_counts
63
67
  bar += count.to_s.rjust(width - bar_width)
@@ -1,6 +1,6 @@
1
1
  module MoreMath
2
2
  # MoreMath version
3
- VERSION = '1.0.0'
3
+ VERSION = '1.0.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/more_math.gemspec CHANGED
@@ -1,14 +1,14 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: more_math 1.0.0 ruby lib
2
+ # stub: more_math 1.0.1 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "more_math".freeze
6
- s.version = "1.0.0"
6
+ s.version = "1.0.1"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2023-05-26"
11
+ s.date = "2023-05-29"
12
12
  s.description = "Library that provides more mathematical functions/algorithms than standard Ruby.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.extra_rdoc_files = ["README.md".freeze, "lib/more_math.rb".freeze, "lib/more_math/cantor_pairing_function.rb".freeze, "lib/more_math/constants/functions_constants.rb".freeze, "lib/more_math/continued_fraction.rb".freeze, "lib/more_math/distributions.rb".freeze, "lib/more_math/entropy.rb".freeze, "lib/more_math/exceptions.rb".freeze, "lib/more_math/functions.rb".freeze, "lib/more_math/histogram.rb".freeze, "lib/more_math/linear_regression.rb".freeze, "lib/more_math/newton_bisection.rb".freeze, "lib/more_math/numberify_string_function.rb".freeze, "lib/more_math/permutation.rb".freeze, "lib/more_math/ranking_common.rb".freeze, "lib/more_math/sequence.rb".freeze, "lib/more_math/sequence/moving_average.rb".freeze, "lib/more_math/sequence/refinement.rb".freeze, "lib/more_math/string_numeral.rb".freeze, "lib/more_math/subset.rb".freeze, "lib/more_math/version.rb".freeze]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: more_math
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-26 00:00:00.000000000 Z
11
+ date: 2023-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar