nepali_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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/Rakefile +81 -0
- data/lib/nepali_number/currency.rb +1 -1
- data/lib/nepali_number/money_integration.rb +2 -2
- data/lib/nepali_number/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 53c5a8948ff5001b817cf6d50aa1eb976b40d1f196f64aaf41247829f4df8ff9
|
|
4
|
+
data.tar.gz: 2111bea2826bb3dac0b07f43eae8f092ebb5846bcfbdc19eba2a5b6142725d5a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5701edfaaf508c38c20918212873035448218361bbd5a47da860c04a22060ff1fadd07c7d33e97cb7d0617385eb36893fcd9a70f8db9a70c631da84a4ff4ef8a
|
|
7
|
+
data.tar.gz: e4cc344934ac8fd2d2033bb17eab1e1fa94a02e789beb176116b168f38ee6e27f5f8824a2125a15d642d026650f8a927b436280eb62dba862e837522d9291f5f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [0.1.1] - 2026-09-06
|
|
2
|
+
|
|
3
|
+
- Change default currency symbol from `रु.` to `रु` and remove the default space, so `NepaliNumber.currency(100)` now returns `रु100` (matching `रु1.45` style per Wikipedia/NPR convention).
|
|
4
|
+
|
|
1
5
|
## [0.1.0] - 2026-05-27
|
|
2
6
|
|
|
3
7
|
- Merge the richer Devanagari/Nepali-number implementation into `nepali_number`.
|
data/README.md
CHANGED
|
@@ -26,10 +26,10 @@ NepaliNumber.format("123456.78")
|
|
|
26
26
|
|
|
27
27
|
```ruby
|
|
28
28
|
NepaliNumber.currency(100)
|
|
29
|
-
# => "
|
|
29
|
+
# => "रु100"
|
|
30
30
|
|
|
31
31
|
NepaliNumber.currency(1234567.89, nepali: true)
|
|
32
|
-
# => "
|
|
32
|
+
# => "रु१२,३४,५६७.८९"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Digit conversion
|
data/Rakefile
CHANGED
|
@@ -1,10 +1,91 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
|
+
require "fileutils"
|
|
4
5
|
require "minitest/test_task"
|
|
6
|
+
require_relative "lib/nepali_number/version"
|
|
5
7
|
|
|
6
8
|
Minitest::TestTask.create
|
|
7
9
|
|
|
8
10
|
require "standard/rake"
|
|
9
11
|
|
|
10
12
|
task default: %i[test standard]
|
|
13
|
+
|
|
14
|
+
release_gem_name = "nepali_number"
|
|
15
|
+
release_gemspec = "#{release_gem_name}.gemspec"
|
|
16
|
+
release_version = NepaliNumber::VERSION
|
|
17
|
+
release_gem_file = "pkg/#{release_gem_name}-#{release_version}.gem"
|
|
18
|
+
|
|
19
|
+
namespace :release do
|
|
20
|
+
desc "Bump version. Usage: rake release:bump[patch|minor|major|0.2.0]"
|
|
21
|
+
task :bump, [:level_or_version] do |_, args|
|
|
22
|
+
current_version = Gem::Version.new(NepaliNumber::VERSION)
|
|
23
|
+
next_version = next_release_version(current_version, args[:level_or_version])
|
|
24
|
+
version_file = "lib/nepali_number/version.rb"
|
|
25
|
+
contents = File.read(version_file)
|
|
26
|
+
updated = contents.sub(/VERSION = "[^"]+"/, %(VERSION = "#{next_version}"))
|
|
27
|
+
|
|
28
|
+
abort "Could not find VERSION assignment in #{version_file}" if contents == updated
|
|
29
|
+
|
|
30
|
+
File.write(version_file, updated)
|
|
31
|
+
puts "Bumped #{release_gem_name} from #{current_version} to #{next_version}"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
desc "Verify the working tree has no uncommitted changes"
|
|
35
|
+
task :check_clean do
|
|
36
|
+
status = `git status --porcelain`.strip
|
|
37
|
+
abort "Working tree is not clean:\n#{status}" unless status.empty?
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
desc "Build #{release_gem_name} #{release_version} into pkg/"
|
|
41
|
+
task :build do
|
|
42
|
+
FileUtils.mkdir_p("pkg")
|
|
43
|
+
FileUtils.rm_f(release_gem_file)
|
|
44
|
+
sh "gem build #{release_gemspec} --output #{release_gem_file}"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Print the manual commands for publishing #{release_gem_name} #{release_version}"
|
|
48
|
+
task :commands do
|
|
49
|
+
puts
|
|
50
|
+
puts "Release artifact: #{release_gem_file}"
|
|
51
|
+
puts
|
|
52
|
+
puts "Publish:"
|
|
53
|
+
puts " gem push #{release_gem_file}"
|
|
54
|
+
puts
|
|
55
|
+
puts "Tag:"
|
|
56
|
+
puts " git tag v#{release_version}"
|
|
57
|
+
puts " git push origin v#{release_version}"
|
|
58
|
+
puts
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc "Run checks, build the gem, and print publish commands"
|
|
62
|
+
task prepare: [:check_clean, :test, :standard, :build, :commands]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def next_release_version(current_version, level_or_version)
|
|
66
|
+
level_or_version ||= "patch"
|
|
67
|
+
|
|
68
|
+
case level_or_version
|
|
69
|
+
when "patch", "minor", "major"
|
|
70
|
+
bump_version(current_version, level_or_version)
|
|
71
|
+
when /\A\d+\.\d+\.\d+(?:\.[A-Za-z0-9.-]+)?\z/
|
|
72
|
+
Gem::Version.new(level_or_version)
|
|
73
|
+
else
|
|
74
|
+
abort "Unknown version bump '#{level_or_version}'. Use patch, minor, major, or an explicit version like 0.2.0."
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def bump_version(version, level)
|
|
79
|
+
segments = version.segments.first(3)
|
|
80
|
+
segments << 0 while segments.length < 3
|
|
81
|
+
major, minor, patch = segments
|
|
82
|
+
|
|
83
|
+
case level
|
|
84
|
+
when "major"
|
|
85
|
+
Gem::Version.new("#{major + 1}.0.0")
|
|
86
|
+
when "minor"
|
|
87
|
+
Gem::Version.new("#{major}.#{minor + 1}.0")
|
|
88
|
+
when "patch"
|
|
89
|
+
Gem::Version.new("#{major}.#{minor}.#{patch + 1}")
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module NepaliNumber
|
|
4
4
|
class Currency
|
|
5
5
|
class << self
|
|
6
|
-
def format(amount, symbol: "
|
|
6
|
+
def format(amount, symbol: "रु", nepali: false, devanagari: nil, delimiter: ",", separator: ".", space: false)
|
|
7
7
|
formatted = Formatter.format(amount, delimiter: delimiter, separator: separator)
|
|
8
8
|
return nil if formatted.nil?
|
|
9
9
|
|
|
@@ -31,7 +31,7 @@ module NepaliNumber
|
|
|
31
31
|
Money::Currency.register(
|
|
32
32
|
iso_code: "NPR",
|
|
33
33
|
name: "Nepalese Rupee",
|
|
34
|
-
symbol: "
|
|
34
|
+
symbol: "रु",
|
|
35
35
|
subunit: "Paisa",
|
|
36
36
|
subunit_to_unit: 100
|
|
37
37
|
)
|
|
@@ -49,7 +49,7 @@ module NepaliNumber
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def default_symbol_for(currency)
|
|
52
|
-
return "
|
|
52
|
+
return "रु" if currency.iso_code == "NPR"
|
|
53
53
|
|
|
54
54
|
currency.symbol || currency.iso_code
|
|
55
55
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nepali_number
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Saroj Maharjan (zoras)
|
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
71
|
requirements: []
|
|
72
|
-
rubygems_version: 4.0.
|
|
72
|
+
rubygems_version: 4.0.19
|
|
73
73
|
specification_version: 4
|
|
74
74
|
summary: Nepali number formatting, humanization, digit conversion, and currency helpers.
|
|
75
75
|
test_files: []
|