whittaker_tech-midas 0.1.0 → 0.2.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 +4 -4
- data/README.md +4 -4
- data/app/controllers/whittaker_tech/midas/application_controller.rb +1 -5
- data/app/helpers/whittaker_tech/midas/application_helper.rb +1 -5
- data/app/helpers/whittaker_tech/midas/form_helper.rb +68 -72
- data/app/jobs/whittaker_tech/midas/application_job.rb +1 -5
- data/app/mailers/whittaker_tech/midas/application_mailer.rb +3 -7
- data/app/models/concerns/whittaker_tech/midas/bankable.rb +193 -174
- data/app/models/whittaker_tech/midas/application_record.rb +2 -6
- data/app/models/whittaker_tech/midas/coin/allocation.rb +124 -0
- data/app/models/whittaker_tech/midas/coin/arithmetic.rb +196 -0
- data/app/models/whittaker_tech/midas/coin/bidi.rb +87 -0
- data/app/models/whittaker_tech/midas/coin/converter.rb +32 -0
- data/app/models/whittaker_tech/midas/coin/parser.rb +104 -0
- data/app/models/whittaker_tech/midas/coin/presenter.rb +229 -0
- data/app/models/whittaker_tech/midas/coin.rb +314 -76
- data/db/migrate/20260101000000_create_whittaker_tech_schema.rb +26 -0
- data/db/migrate/{20251015160523_create_wt_midas_coins.rb → 20260101000001_create_midas_coins.rb} +7 -3
- data/db/migrate/20260219120000_rename_resource_label_to_resource_role_in_wt_midas_coins.rb +12 -0
- data/db/migrate/20260219150000_rename_wt_midas_coins_to_midas_coins.rb +13 -0
- data/lib/generators/whittaker_tech/midas/install/install_generator.rb +10 -0
- data/lib/tasks/whittaker_tech/midas_tasks.rake +27 -4
- data/lib/whittaker_tech/midas/deprecation.rb +32 -0
- data/lib/whittaker_tech/midas/engine.rb +113 -110
- data/lib/whittaker_tech/midas/version.rb +4 -4
- data/lib/whittaker_tech/midas.rb +120 -3
- metadata +71 -19
- data/config/routes.rb +0 -2
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class RenameWtMidasCoinsToMidasCoins < ActiveRecord::Migration[8.0]
|
|
4
|
+
def change
|
|
5
|
+
rename_table :wt_midas_coins, :midas_coins
|
|
6
|
+
rename_index :midas_coins,
|
|
7
|
+
'index_wt_midas_coins_on_resource_and_role',
|
|
8
|
+
'index_midas_coins_on_resource_and_role'
|
|
9
|
+
rename_index :midas_coins,
|
|
10
|
+
'index_wt_midas_coins_on_resource',
|
|
11
|
+
'index_midas_coins_on_resource'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class WhittakerTech::Midas::Generators::InstallGenerator < Rails::Generators::Base
|
|
4
|
+
desc 'Installs Midas and copies migrations.'
|
|
5
|
+
|
|
6
|
+
def copy_migrations
|
|
7
|
+
say_status 'migrations', 'Copying migrations for Midas...', :green
|
|
8
|
+
rake 'midas:install:migrations'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
namespace :midas do
|
|
4
|
+
namespace :install do
|
|
5
|
+
desc 'Copy Midas migrations to your application.'
|
|
6
|
+
task migrations: :environment do
|
|
7
|
+
engine = WhittakerTech::Midas::Engine
|
|
8
|
+
source = engine.root.join('db/migrate')
|
|
9
|
+
destination = Rails.root.join('db/migrate')
|
|
10
|
+
|
|
11
|
+
FileUtils.mkdir_p(destination)
|
|
12
|
+
|
|
13
|
+
Dir.glob(source.join('*.rb')).each_with_index do |migration, i|
|
|
14
|
+
filename = File.basename(migration)
|
|
15
|
+
timestamp = (Time.now.utc + i).strftime('%Y%m%d%H%M%S')
|
|
16
|
+
target = destination.join("#{timestamp}_#{filename}")
|
|
17
|
+
|
|
18
|
+
if File.exist?(target)
|
|
19
|
+
puts "Skipping #{filename} because it already exists."
|
|
20
|
+
else
|
|
21
|
+
FileUtils.cp migration, target
|
|
22
|
+
puts "Copied #{filename} to #{target}."
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Emits or raises deprecation notices for Midas API changes.
|
|
4
|
+
#
|
|
5
|
+
# Behavior is controlled by WhittakerTech::Midas.deprecation_behavior:
|
|
6
|
+
# :warn - prints a warning to STDERR (default)
|
|
7
|
+
# :raise - raises a DeprecationError (useful in test mode)
|
|
8
|
+
# :silence - suppresses all notices
|
|
9
|
+
module WhittakerTech::Midas::Deprecation
|
|
10
|
+
# Removal horizon advertised in deprecation messages.
|
|
11
|
+
HORIZON = '0.3.0'
|
|
12
|
+
|
|
13
|
+
# Error raised when deprecation_behavior is :raise.
|
|
14
|
+
class DeprecationError < StandardError; end
|
|
15
|
+
|
|
16
|
+
# Emits a deprecation notice for `message` attributed to `callsite`.
|
|
17
|
+
#
|
|
18
|
+
# @param message [String] human-readable deprecation description
|
|
19
|
+
# @param callsite [Thread::Backtrace::Location, nil]
|
|
20
|
+
def self.warn(message, callsite = caller_locations(1, 1).first)
|
|
21
|
+
location = callsite ? "#{callsite.path}:#{callsite.lineno}" : 'unknown'
|
|
22
|
+
full = "[DEPRECATED] #{message} " \
|
|
23
|
+
"(called from #{location}). " \
|
|
24
|
+
"Will be removed in whittaker_tech-midas #{HORIZON}."
|
|
25
|
+
|
|
26
|
+
case WhittakerTech::Midas.deprecation_behavior
|
|
27
|
+
when :raise then raise DeprecationError, full
|
|
28
|
+
when :silence then nil
|
|
29
|
+
else Kernel.warn full
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -1,117 +1,120 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
3
|
+
# The Midas Engine provides monetary value management capabilities as a Rails Engine.
|
|
4
|
+
# It integrates seamlessly with Rails applications to add currency handling, coin management,
|
|
5
|
+
# and monetary formatting functionality through the Bankable concern and related components.
|
|
6
|
+
#
|
|
7
|
+
# This engine follows Rails Engine conventions and can be mounted in any Rails application
|
|
8
|
+
# to provide comprehensive monetary value handling capabilities. It includes models, helpers,
|
|
9
|
+
# and utilities for working with currencies and monetary amounts.
|
|
10
|
+
#
|
|
11
|
+
# == Features
|
|
12
|
+
#
|
|
13
|
+
# - **Bankable Concern**: Allows any Active Record model to have monetary attributes
|
|
14
|
+
# - **Coin Model**: Stores monetary values with currency information
|
|
15
|
+
# - **Form Helpers**: View helpers for monetary input and display
|
|
16
|
+
# - **Currency Management**: Integration with the Money gem for currency operations
|
|
17
|
+
# - **Namespace Isolation**: Clean separation from host application code
|
|
18
|
+
#
|
|
19
|
+
# == Installation and Setup
|
|
20
|
+
#
|
|
21
|
+
# Add the engine to your Rails application's Gemfile and run bundle install.
|
|
22
|
+
# The engine will automatically configure itself when Rails boots.
|
|
23
|
+
#
|
|
24
|
+
# @example Adding to a Rails application
|
|
25
|
+
# # In your Gemfile
|
|
26
|
+
# gem 'whittaker_tech-midas'
|
|
27
|
+
#
|
|
28
|
+
# # The engine auto-configures on Rails boot
|
|
29
|
+
# # No additional setup required
|
|
30
|
+
#
|
|
31
|
+
# == Usage in Host Applications
|
|
32
|
+
#
|
|
33
|
+
# Once installed, the engine's functionality becomes available throughout
|
|
34
|
+
# your Rails application:
|
|
35
|
+
#
|
|
36
|
+
# @example Using Bankable in models
|
|
37
|
+
# class Product < ApplicationRecord
|
|
38
|
+
# include WhittakerTech::Midas::Bankable
|
|
39
|
+
# has_coin :price
|
|
40
|
+
# end
|
|
41
|
+
#
|
|
42
|
+
# @example Using form helpers in views
|
|
43
|
+
# <%= form_with model: @product do |form| %>
|
|
44
|
+
# <%= form.money_field :price %>
|
|
45
|
+
# <% end %>
|
|
46
|
+
#
|
|
47
|
+
# == Configuration
|
|
48
|
+
#
|
|
49
|
+
# The engine provides several configuration points:
|
|
50
|
+
#
|
|
51
|
+
# - **Eager Loading**: Automatically configures model loading paths
|
|
52
|
+
# - **Helper Integration**: Injects form helpers into ActionView
|
|
53
|
+
# - **Namespace Isolation**: Keeps engine code separate from host application
|
|
54
|
+
#
|
|
55
|
+
# == Directory Structure
|
|
56
|
+
#
|
|
57
|
+
# The engine follows standard Rails Engine structure:
|
|
58
|
+
# - `app/models/`: Coin model and concerns
|
|
59
|
+
# - `app/helpers/`: Form helpers for monetary inputs
|
|
60
|
+
# - `db/migrate/`: Database migrations for coin storage
|
|
61
|
+
# - `lib/`: Engine configuration and initialization
|
|
62
|
+
#
|
|
63
|
+
# == Database Integration
|
|
64
|
+
#
|
|
65
|
+
# The engine provides database migrations that create the necessary tables
|
|
66
|
+
# for storing monetary values. Run migrations after installation:
|
|
67
|
+
#
|
|
68
|
+
# @example Running migrations
|
|
69
|
+
# rails db:migrate
|
|
70
|
+
#
|
|
71
|
+
# == Namespace Isolation
|
|
72
|
+
#
|
|
73
|
+
# The engine uses `isolate_namespace` to prevent conflicts with host
|
|
74
|
+
# application code. All engine components are properly namespaced under
|
|
75
|
+
# `WhittakerTech::Midas`.
|
|
76
|
+
#
|
|
77
|
+
# == Helper Integration
|
|
78
|
+
#
|
|
79
|
+
# Form helpers are automatically made available in all views through
|
|
80
|
+
# an initializer that extends ActionView::Base when the view layer loads.
|
|
81
|
+
# This provides seamless integration without requiring manual includes.
|
|
82
|
+
#
|
|
83
|
+
# == Eager Loading
|
|
84
|
+
#
|
|
85
|
+
# The engine configures additional eager load paths to ensure all models
|
|
86
|
+
# are properly loaded in production environments. This includes the models
|
|
87
|
+
# directory which contains the Coin model and Bankable concern.
|
|
88
|
+
#
|
|
89
|
+
# == Thread Safety
|
|
90
|
+
#
|
|
91
|
+
# The engine follows Rails conventions for thread safety and can be safely
|
|
92
|
+
# used in multi-threaded environments like Puma or Falcon.
|
|
93
|
+
#
|
|
94
|
+
# == Development and Testing
|
|
95
|
+
#
|
|
96
|
+
# The engine can be developed and tested independently using its own
|
|
97
|
+
# test suite, or integrated into a host application for testing.
|
|
98
|
+
#
|
|
99
|
+
# See also:
|
|
100
|
+
#
|
|
101
|
+
# - `WhittakerTech::Midas::Bankable`
|
|
102
|
+
# - `WhittakerTech::Midas::Coin`
|
|
103
|
+
# - `WhittakerTech::Midas::FormHelper`
|
|
104
|
+
# @since 0.1.0
|
|
105
|
+
class WhittakerTech::Midas::Engine < Rails::Engine
|
|
106
|
+
isolate_namespace WhittakerTech::Midas
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
config.eager_load_paths += Dir["#{config.root}/app/models"]
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
end
|
|
114
|
-
end
|
|
110
|
+
initializer 'midas.helpers' do
|
|
111
|
+
ActiveSupport.on_load(:action_view) do
|
|
112
|
+
include WhittakerTech::Midas::FormHelper
|
|
115
113
|
end
|
|
116
114
|
end
|
|
115
|
+
|
|
116
|
+
rake_tasks do
|
|
117
|
+
tasks_path = root.join('tasks/**/*.rake')
|
|
118
|
+
Dir[tasks_path].each { |file| load file }
|
|
119
|
+
end
|
|
117
120
|
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
module WhittakerTech
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
module WhittakerTech; end
|
|
2
|
+
|
|
3
|
+
module WhittakerTech::Midas
|
|
4
|
+
VERSION = '0.2.0'.freeze
|
|
5
5
|
end
|
data/lib/whittaker_tech/midas.rb
CHANGED
|
@@ -1,11 +1,128 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'whittaker_tech/midas/version'
|
|
4
|
+
require 'whittaker_tech/midas/deprecation'
|
|
4
5
|
require 'whittaker_tech/midas/engine'
|
|
5
6
|
require 'money'
|
|
7
|
+
require 'poly'
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
# WhittakerTech::Midas is a Rails engine for multi-currency monetary value
|
|
10
|
+
# management. It replaces scattered `*_cents` and `*_currency` columns with a
|
|
11
|
+
# single polymorphic `Coin` model backed by a centralized `midas_coins`
|
|
12
|
+
# table.
|
|
13
|
+
#
|
|
14
|
+
# ## Configuration
|
|
15
|
+
#
|
|
16
|
+
# ### Table namespace (PostgreSQL schema)
|
|
17
|
+
#
|
|
18
|
+
# By default all coins are stored in `midas_coins`. To place the table
|
|
19
|
+
# inside a PostgreSQL schema set `table_namespace` in an initializer:
|
|
20
|
+
#
|
|
21
|
+
# WhittakerTech::Midas.table_namespace = 'finance'
|
|
22
|
+
# # => table becomes finance.coins
|
|
23
|
+
#
|
|
24
|
+
# ### Bidirectional text
|
|
25
|
+
#
|
|
26
|
+
# Currency display direction defaults to LTR for every currency code.
|
|
27
|
+
# Override individual currencies as needed:
|
|
28
|
+
#
|
|
29
|
+
# WhittakerTech::Midas.currency_directions['ILS'] = :rtl
|
|
30
|
+
# WhittakerTech::Midas.currency_directions['AED'] = :rtl
|
|
31
|
+
#
|
|
32
|
+
# See also:
|
|
33
|
+
#
|
|
34
|
+
# - `Coin`
|
|
35
|
+
# - `Coin::Arithmetic`
|
|
36
|
+
# - `Bankable`
|
|
37
|
+
# @since 0.1.0
|
|
38
|
+
module WhittakerTech::Midas
|
|
39
|
+
# Rounding strategies available for division operations.
|
|
40
|
+
#
|
|
41
|
+
# Each value is a lambda that accepts a Float and returns a rounded value.
|
|
42
|
+
#
|
|
43
|
+
# Rounding keys:
|
|
44
|
+
#
|
|
45
|
+
# - `:round`: Round half-up (standard commercial rounding)
|
|
46
|
+
# - `:ceil`: Always round up (ceiling)
|
|
47
|
+
# - `:floor`: Always round down (floor / truncate)
|
|
48
|
+
# - `:bankers`: Round half-to-even (banker's rounding)
|
|
49
|
+
#
|
|
50
|
+
# @return [Hash{Symbol => Proc}]
|
|
51
|
+
ROUNDING_POLICIES = {
|
|
52
|
+
round: ->(v) { v.round },
|
|
53
|
+
ceil: ->(v) { v.ceil },
|
|
54
|
+
floor: ->(v) { v.floor },
|
|
55
|
+
bankers: ->(v) { v.round(0, half: :even) }
|
|
56
|
+
}.freeze
|
|
57
|
+
|
|
58
|
+
# The rounding policy applied when no explicit policy is supplied.
|
|
59
|
+
# @return [Symbol]
|
|
60
|
+
DEFAULT_ROUNDING_POLICY = :round
|
|
61
|
+
|
|
62
|
+
# Optional PostgreSQL schema name used to namespace the coins table.
|
|
63
|
+
#
|
|
64
|
+
# When `nil` (default) the table is created as `midas_coins`.
|
|
65
|
+
# When set, the table becomes `<namespace>.coins` and requires a PostgreSQL
|
|
66
|
+
# adapter.
|
|
67
|
+
#
|
|
68
|
+
# @return [String, nil]
|
|
69
|
+
mattr_accessor :table_namespace, default: nil
|
|
70
|
+
|
|
71
|
+
# Controls how deprecation notices are emitted.
|
|
72
|
+
#
|
|
73
|
+
# Allowed values:
|
|
74
|
+
#
|
|
75
|
+
# - `:warn`: Prints to STDERR via `Kernel.warn` (default)
|
|
76
|
+
# - `:raise`: Raises `Deprecation::DeprecationError`
|
|
77
|
+
# - `:silence`: Suppresses all notices
|
|
78
|
+
#
|
|
79
|
+
# @return [Symbol]
|
|
80
|
+
mattr_accessor :deprecation_behavior, default: :warn
|
|
81
|
+
|
|
82
|
+
# Resolves the fully-qualified table name for a given base name.
|
|
83
|
+
#
|
|
84
|
+
# @param name [String] base table name, e.g. `"coins"`
|
|
85
|
+
# @return [String] the namespaced table name
|
|
86
|
+
# @raise [RuntimeError] if `table_namespace` is set and the adapter is not PostgreSQL
|
|
87
|
+
def self.table_name(name)
|
|
88
|
+
return "midas_#{name}" if table_namespace.blank?
|
|
89
|
+
|
|
90
|
+
adapter = ActiveRecord::Base.connection.adapter_name
|
|
91
|
+
raise "WhittakerTech::Midas.table_namespace requires PostgreSQL (got #{adapter})" unless adapter == 'PostgreSQL'
|
|
92
|
+
|
|
93
|
+
"#{table_namespace}.#{name}"
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Per-currency display direction map. Defaults all currencies to `:ltr`.
|
|
97
|
+
#
|
|
98
|
+
# Modify to configure RTL currencies in your initializer:
|
|
99
|
+
#
|
|
100
|
+
# WhittakerTech::Midas.currency_directions['ILS'] = :rtl
|
|
101
|
+
#
|
|
102
|
+
# @return [Hash{String => Symbol}] maps uppercased ISO currency code to `:ltr` or `:rtl`
|
|
103
|
+
def self.currency_directions
|
|
104
|
+
@currency_directions ||= Hash.new(:ltr)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# Returns the configured display direction for the given currency code.
|
|
108
|
+
#
|
|
109
|
+
# Falls back to `:ltr` for any currency not explicitly configured.
|
|
110
|
+
#
|
|
111
|
+
# @param currency_code [String] ISO 4217 currency code, e.g. `"USD"`
|
|
112
|
+
# @return [Symbol] `:ltr` or `:rtl`
|
|
113
|
+
def self.currency_direction_for(currency_code)
|
|
114
|
+
currency_directions[currency_code.to_s.upcase]
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Resets all mutable configuration to defaults.
|
|
118
|
+
#
|
|
119
|
+
# Intended for use in test suite `after` blocks when specs mutate
|
|
120
|
+
# engine-level configuration.
|
|
121
|
+
#
|
|
122
|
+
# @return [void]
|
|
123
|
+
def self.reset_configuration!
|
|
124
|
+
self.table_namespace = nil
|
|
125
|
+
self.deprecation_behavior = :warn
|
|
126
|
+
@currency_directions = nil
|
|
10
127
|
end
|
|
11
128
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whittaker_tech-midas
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Lee Whittaker
|
|
@@ -23,6 +23,20 @@ dependencies:
|
|
|
23
23
|
- - "~>"
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 6.19.0
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: poly
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
41
|
name: rails
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,33 +66,33 @@ dependencies:
|
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
67
|
version: '6.4'
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
69
|
+
name: puma
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
57
71
|
requirements:
|
|
58
72
|
- - "~>"
|
|
59
73
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
74
|
+
version: '6.0'
|
|
61
75
|
type: :development
|
|
62
76
|
prerelease: false
|
|
63
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
64
78
|
requirements:
|
|
65
79
|
- - "~>"
|
|
66
80
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
81
|
+
version: '6.0'
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
|
-
name:
|
|
83
|
+
name: rspec
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
71
85
|
requirements:
|
|
72
|
-
- - "
|
|
86
|
+
- - ">="
|
|
73
87
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
88
|
+
version: '0'
|
|
75
89
|
type: :development
|
|
76
90
|
prerelease: false
|
|
77
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
78
92
|
requirements:
|
|
79
|
-
- - "
|
|
93
|
+
- - ">="
|
|
80
94
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '
|
|
95
|
+
version: '0'
|
|
82
96
|
- !ruby/object:Gem::Dependency
|
|
83
97
|
name: rspec-rails
|
|
84
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -149,10 +163,39 @@ dependencies:
|
|
|
149
163
|
- - "~>"
|
|
150
164
|
- !ruby/object:Gem::Version
|
|
151
165
|
version: '3.5'
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
166
|
+
- !ruby/object:Gem::Dependency
|
|
167
|
+
name: yard
|
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
|
169
|
+
requirements:
|
|
170
|
+
- - ">="
|
|
171
|
+
- !ruby/object:Gem::Version
|
|
172
|
+
version: '0'
|
|
173
|
+
type: :development
|
|
174
|
+
prerelease: false
|
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
176
|
+
requirements:
|
|
177
|
+
- - ">="
|
|
178
|
+
- !ruby/object:Gem::Version
|
|
179
|
+
version: '0'
|
|
180
|
+
- !ruby/object:Gem::Dependency
|
|
181
|
+
name: yard-markdown
|
|
182
|
+
requirement: !ruby/object:Gem::Requirement
|
|
183
|
+
requirements:
|
|
184
|
+
- - ">="
|
|
185
|
+
- !ruby/object:Gem::Version
|
|
186
|
+
version: '0'
|
|
187
|
+
type: :development
|
|
188
|
+
prerelease: false
|
|
189
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
190
|
+
requirements:
|
|
191
|
+
- - ">="
|
|
192
|
+
- !ruby/object:Gem::Version
|
|
193
|
+
version: '0'
|
|
194
|
+
description: |
|
|
195
|
+
WhittakerTech Midas is a Rails engine that provides elegant multi-currency support
|
|
196
|
+
through a single polymorphic Coin model. Instead of adding price_cents/price_currency
|
|
197
|
+
columns to every model, Midas stores all monetary values in one place with a simple
|
|
198
|
+
has_coins DSL. Includes bank-style currency input fields powered by Stimulus.
|
|
156
199
|
email:
|
|
157
200
|
- lee@whittakertech.com
|
|
158
201
|
executables: []
|
|
@@ -173,13 +216,23 @@ files:
|
|
|
173
216
|
- app/models/concerns/whittaker_tech/midas/bankable.rb
|
|
174
217
|
- app/models/whittaker_tech/midas/application_record.rb
|
|
175
218
|
- app/models/whittaker_tech/midas/coin.rb
|
|
219
|
+
- app/models/whittaker_tech/midas/coin/allocation.rb
|
|
220
|
+
- app/models/whittaker_tech/midas/coin/arithmetic.rb
|
|
221
|
+
- app/models/whittaker_tech/midas/coin/bidi.rb
|
|
222
|
+
- app/models/whittaker_tech/midas/coin/converter.rb
|
|
223
|
+
- app/models/whittaker_tech/midas/coin/parser.rb
|
|
224
|
+
- app/models/whittaker_tech/midas/coin/presenter.rb
|
|
176
225
|
- app/views/layouts/whittaker_tech/midas/application.html.erb
|
|
177
226
|
- app/views/layouts/whittaker_tech/midas/shared/_currency_field.html.erb
|
|
178
227
|
- config/locales/midas.en.yml
|
|
179
|
-
-
|
|
180
|
-
- db/migrate/
|
|
228
|
+
- db/migrate/20260101000000_create_whittaker_tech_schema.rb
|
|
229
|
+
- db/migrate/20260101000001_create_midas_coins.rb
|
|
230
|
+
- db/migrate/20260219120000_rename_resource_label_to_resource_role_in_wt_midas_coins.rb
|
|
231
|
+
- db/migrate/20260219150000_rename_wt_midas_coins_to_midas_coins.rb
|
|
232
|
+
- lib/generators/whittaker_tech/midas/install/install_generator.rb
|
|
181
233
|
- lib/tasks/whittaker_tech/midas_tasks.rake
|
|
182
234
|
- lib/whittaker_tech/midas.rb
|
|
235
|
+
- lib/whittaker_tech/midas/deprecation.rb
|
|
183
236
|
- lib/whittaker_tech/midas/engine.rb
|
|
184
237
|
- lib/whittaker_tech/midas/version.rb
|
|
185
238
|
homepage: https://github.com/whittakertech/midas
|
|
@@ -188,10 +241,9 @@ licenses:
|
|
|
188
241
|
metadata:
|
|
189
242
|
homepage_uri: https://github.com/whittakertech/midas
|
|
190
243
|
source_code_uri: https://github.com/whittakertech/midas
|
|
191
|
-
changelog_uri: https://github.com/whittakertech/midas/blob/
|
|
244
|
+
changelog_uri: https://github.com/whittakertech/midas/blob/master/CHANGELOG.md
|
|
192
245
|
bug_tracker_uri: https://github.com/whittakertech/midas/issues
|
|
193
246
|
documentation_uri: https://midas.whittakertech.com/
|
|
194
|
-
rubygems_mfa_required: 'true'
|
|
195
247
|
rdoc_options: []
|
|
196
248
|
require_paths:
|
|
197
249
|
- lib
|
|
@@ -199,14 +251,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
199
251
|
requirements:
|
|
200
252
|
- - ">="
|
|
201
253
|
- !ruby/object:Gem::Version
|
|
202
|
-
version: 3.
|
|
254
|
+
version: 3.2.0
|
|
203
255
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
256
|
requirements:
|
|
205
257
|
- - ">="
|
|
206
258
|
- !ruby/object:Gem::Version
|
|
207
259
|
version: '0'
|
|
208
260
|
requirements: []
|
|
209
|
-
rubygems_version: 3.
|
|
261
|
+
rubygems_version: 3.6.9
|
|
210
262
|
specification_version: 4
|
|
211
263
|
summary: Multi-currency money management for Rails with polymorphic coin storage
|
|
212
264
|
test_files: []
|
data/config/routes.rb
DELETED