human_number 0.1.0 → 0.1.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: 7acf2929c3de8758cfbf05e32ec42a46c87ae2afb582f6fbbf0aeb8bcf6f9ede
4
- data.tar.gz: 2ef9d5f7c7381ab0f13e1b4ec6936a9c55c16762fd87090a51810c1c7b6054af
3
+ metadata.gz: 3464be66cdbc375a6612c468bc7aeffdff928b8bc1af7857d2f261440f4a3f7f
4
+ data.tar.gz: 6ddf79c2ddd6cf5595b70a798cb035b730a7c5c6ba7c7e5d2dff726993d934c4
5
5
  SHA512:
6
- metadata.gz: db81f31340cffd25a57aaaa6ecfe465231342c7cdefc420c37aa6855b23fe34abe4e06fddce0d5d1b0fd453115b01fb5a1718fdc0a54340c713e860bd4a2ae80
7
- data.tar.gz: 2030078ab34f98cac34b8588c20cd240f9065f2be0dcfaf4d750e8123d4d232fcdc8b9fdac1588d8f3bbc5344b13bc4f4b4cdb7965b69c387cec1fef9c5e8bf5
6
+ metadata.gz: 178108029dc2a438d5a19dc5f66c9b2850d6dd593072c8ceade307549d58749cb809d73094306cd64b8bcfe870bfc3823a0c945d1454c8cc2aef4c703f2a34cd
7
+ data.tar.gz: c562f9d5ea7abe1bff8b31b6889a5df768f755a62490e7ea2aa6bbaef312e08feb2e29ffc1aa61f9f01f2f35ca452104d5e46dc1ccd7487c12c439196f59f10b
data/CHANGELOG.md CHANGED
@@ -38,7 +38,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
38
  - **Automatic Rails detection** and helper loading via Railtie
39
39
  - **View helpers**: `human_number`, `currency`, `human_currency` with Rails-friendly parameter handling
40
40
  - **I18n integration**: Automatic locale detection from `I18n.locale`
41
- - **Legacy compatibility**: `number_to_human_size` alias for backward compatibility
42
41
 
43
42
  #### Locale Data System
44
43
  - **Hybrid locale approach**: Combines rails-i18n for base formatting with custom locale files for unit symbols
@@ -87,4 +86,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
87
86
  - **Formatters::Currency**: Currency symbol and format string application
88
87
  - **Clean separation**: Number formatting independent of currency concerns
89
88
 
90
- [0.1.0]: https://github.com/yourusername/human_number/releases/tag/v0.1.0
89
+ [0.1.0]: https://github.com/yourusername/human_number/releases/tag/v0.1.0
@@ -28,8 +28,7 @@ module HumanNumber
28
28
  # <%= human_number(1234567, max_digits: 2) %> #=> "1.23M"
29
29
  #
30
30
  # @see HumanNumber.human_number Main implementation
31
- def human_number(number, locale: nil, **options)
32
- locale ||= I18n.locale
31
+ def human_number(number, locale: I18n.locale, **options)
33
32
  HumanNumber.human_number(number, locale:, **options)
34
33
  end
35
34
 
@@ -50,8 +49,7 @@ module HumanNumber
50
49
  # <%= currency(1234.99, currency_code: 'JPY') %> #=> "1,235円"
51
50
  #
52
51
  # @see HumanNumber.currency Main implementation
53
- def currency(number, currency_code:, locale: nil)
54
- locale ||= I18n.locale
52
+ def currency(number, currency_code:, locale: I18n.locale)
55
53
  HumanNumber.currency(number, currency_code:, locale:)
56
54
  end
57
55
 
@@ -78,21 +76,9 @@ module HumanNumber
78
76
  # <%= human_currency(1000000, currency_code: 'USD', abbr_units: false) %> #=> "$1 million"
79
77
  #
80
78
  # @see HumanNumber.human_currency Main implementation
81
- def human_currency(number, currency_code:, locale: nil, **options)
82
- locale ||= I18n.locale
79
+ def human_currency(number, currency_code:, locale: I18n.locale, **options)
83
80
  HumanNumber.human_currency(number, currency_code:, locale:, **options)
84
81
  end
85
-
86
- # Legacy alias for human_number to maintain backward compatibility.
87
- #
88
- # @deprecated Use {#human_number} instead
89
- # @param number [Numeric] The number to format
90
- # @param options [Hash] Formatting options (Rails-style hash)
91
- # @return [String] The formatted number string
92
- def number_to_human_size(number, **options)
93
- locale = options.delete(:locale) || I18n.locale
94
- human_number(number, locale:, **options)
95
- end
96
82
  end
97
83
  end
98
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HumanNumber
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/human_number.rb CHANGED
@@ -104,7 +104,7 @@ module HumanNumber
104
104
  # @see Formatters::Number.format_with_currency_precision Currency precision logic
105
105
  # @see Formatters::Currency.format Currency symbol and format application
106
106
  # @since 1.0.0
107
- def currency(number, currency_code:, locale:)
107
+ def currency(number, currency_code:, locale: I18n.locale)
108
108
  validate_number_input!(number)
109
109
  validate_currency_code!(currency_code)
110
110
  validate_locale!(locale)
@@ -154,7 +154,7 @@ module HumanNumber
154
154
  # @see #human_number For detailed number formatting options
155
155
  # @see #currency For standard currency formatting without abbreviations
156
156
  # @since 1.0.0
157
- def human_currency(number, currency_code:, locale:, **options)
157
+ def human_currency(number, currency_code:, locale: I18n.locale, **options)
158
158
  validate_number_input!(number)
159
159
  validate_currency_code!(currency_code)
160
160
  validate_locale!(locale)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: human_number
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name
@@ -89,7 +89,6 @@ files:
89
89
  - config/locales/zh-CN.yml
90
90
  - config/locales/zh-TW.yml
91
91
  - config/locales/zh.yml
92
- - human_number.gemspec
93
92
  - lib/human_number.rb
94
93
  - lib/human_number/formatters/currency.rb
95
94
  - lib/human_number/formatters/number.rb
data/human_number.gemspec DELETED
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/human_number/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "human_number"
7
- spec.version = HumanNumber::VERSION
8
- spec.authors = ["Your Name"]
9
- spec.email = ["your.email@example.com"]
10
-
11
- spec.summary = "International standard-based number formatting for Ruby applications"
12
- spec.description = "HumanNumber implements accurate number formatting based on international standards " \
13
- "including Microsoft Globalization documentation and Unicode CLDR. Provides human-readable " \
14
- "number formats with precise locale-specific decimal separators, thousand separators, " \
15
- "currency formats, and cultural number conventions."
16
- spec.homepage = "https://github.com/yourusername/human_number"
17
- spec.license = "MIT"
18
- spec.required_ruby_version = ">= 3.1.0"
19
-
20
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
- spec.metadata["homepage_uri"] = spec.homepage
22
- spec.metadata["source_code_uri"] = "https://github.com/yourusername/human_number"
23
- spec.metadata["changelog_uri"] = "https://github.com/yourusername/human_number/blob/main/CHANGELOG.md"
24
-
25
- # Specify which files should be added to the gem when it is released.
26
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
28
- `git ls-files -z`.split("\x0").reject do |f|
29
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
30
- end
31
- end
32
- spec.bindir = "exe"
33
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
34
- spec.require_paths = ["lib"]
35
-
36
- # Runtime dependencies
37
- spec.add_dependency "actionview", ">= 5.2"
38
- spec.add_dependency "i18n", ">= 1.6", "< 2"
39
- spec.add_dependency "rails-i18n", ">= 5.1"
40
-
41
- spec.metadata["rubygems_mfa_required"] = "true"
42
- end