forme 2.7.0 → 2.8.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: af9c688d8d8f4432cfe214dbc58332a11d57c50e9309b96ba30e7396865a19a7
4
- data.tar.gz: 7c66b8036e5d34a78055e8ba046501f70dcab1b066bf0836548acc5219bcc5b9
3
+ metadata.gz: e839ceeb815ddfe2d04fa1818ce83950f84508f83dee4c7db558f3f5c759c48d
4
+ data.tar.gz: 7620234a8222129d8e134c694bddff58a3e5a4cf0b2144fd23b74305feae7f49
5
5
  SHA512:
6
- metadata.gz: aa5077f2c26acd92526dc3db78aa45c69c5c7ede218120b4eed39683bf8bf4a351b418bd8f8765fd9612e72d0e8879eab5617c9ac9d193103ff5b2c95afd17a6
7
- data.tar.gz: b1999c8bc8ee43a1f3dc1a4601087f067750118cff71b0caf9ba0729e4b7555ffbd3f58ded0bda79f5a53c37a212e79951651e60e9f063c320f6dcda62f67237
6
+ metadata.gz: 2c287628f803ad6f2dec96356c12cade931e31b9560efc379f3a61393248336300b5e4935a0aa74b98ea5202e1050f31b05b84b2743529ce952cc4bada91a6e3
7
+ data.tar.gz: c0b53cf916ed4b392fa721d32f81abaa2ea73f18f848a66f8b8eeaa5196f3f1eb3835e7a67862a4183f2baf8aa9cd33f40faa9023296a16f45067947a9cb6918
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ === 2.8.0 (2026-12-06)
2
+
3
+ * Format BigDecimal with absolute exponent over 20 using scientific notation (jeremyevans)
4
+
5
+ * Use Roda::RodaPlugins.opt_attr_reader if available for slight performance improvement (jeremyevans)
6
+
1
7
  === 2.7.0 (2025-09-16)
2
8
 
3
9
  * Omit closing / for void element tags (only used previously for xhtml compliance) (jeremyevans)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2023 Jeremy Evans
1
+ Copyright (c) 2011-2026 Jeremy Evans and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to
data/README.rdoc CHANGED
@@ -1236,7 +1236,7 @@ This supports the following options:
1236
1236
 
1237
1237
  The :default and :explicit labelers respect the following options:
1238
1238
 
1239
- :label_position :: Can be set to :before or :after to place the label before or after the the input.
1239
+ :label_position :: Can be set to :before or :after to place the label before or after the input.
1240
1240
  :label_attr :: A hash of attributes to use for the label tag
1241
1241
 
1242
1242
  === +wrapper+
data/lib/forme/form.rb CHANGED
@@ -333,9 +333,9 @@ module Forme
333
333
  copy_inputs_wrapper_from_wrapper(opts, @opts)
334
334
  yield
335
335
  ensure
336
- # :nocov:
336
+ # simplecov:disable
337
337
  @opts = orig_opts if orig_opts
338
- # :nocov:
338
+ # simplecov:enable
339
339
  end
340
340
 
341
341
  private
@@ -33,7 +33,11 @@ module Forme
33
33
  when Date
34
34
  format_date(tag)
35
35
  when BigDecimal
36
- tag.to_s('F')
36
+ if tag.exponent.abs > 20
37
+ tag.to_s
38
+ else
39
+ tag.to_s('F')
40
+ end
37
41
  when Raw
38
42
  tag.to_s
39
43
  else
data/lib/forme/version.rb CHANGED
@@ -6,7 +6,7 @@ module Forme
6
6
  MAJOR = 2
7
7
 
8
8
  # The minor version of Forme, updated for new feature releases of Forme.
9
- MINOR = 7
9
+ MINOR = 8
10
10
 
11
11
  # The patch version of Forme, updated only for bug fixes from the last
12
12
  # feature release.
data/lib/forme.rb CHANGED
@@ -11,7 +11,7 @@ module Forme
11
11
  begin
12
12
  require 'erb/escape'
13
13
  define_singleton_method(:h, ERB::Escape.instance_method(:html_escape))
14
- # :nocov:
14
+ # simplecov:disable
15
15
  rescue LoadError
16
16
  begin
17
17
  require 'cgi/escape'
@@ -32,7 +32,7 @@ module Forme
32
32
  end
33
33
  end
34
34
  end
35
- # :nocov:
35
+ # simplecov:enable
36
36
 
37
37
  @default_add_blank_prompt = nil
38
38
  @default_config = :default
@@ -13,7 +13,7 @@ class Roda
13
13
 
14
14
  # Set the HMAC secret.
15
15
  def self.configure(app, opts = OPTS, &block)
16
- unless app.opts[:forme_set_hmac_secret] = opts[:secret] || app.opts[:forme_set_hmac_secret]
16
+ unless app.opts[:forme_set_hmac_secret] = opts[:secret] || app.forme_set_hmac_secret
17
17
  raise RodaError, "must provide :secret option to forme_set plugin"
18
18
  end
19
19
 
@@ -36,6 +36,18 @@ class Roda
36
36
  :missing_namespace=>"no content in expected namespace"
37
37
  }.freeze
38
38
 
39
+ module ClassMethods
40
+ if Roda::RodaPlugins.respond_to?(:opt_attr_reader)
41
+ Roda::RodaPlugins.opt_attr_reader(self, :forme_set_hmac_secret)
42
+ # simplecov:disable
43
+ else
44
+ def forme_set_hmac_secret
45
+ opts[:forme_set_hmac_secret]
46
+ end
47
+ # simplecov:enable
48
+ end
49
+ end
50
+
39
51
  module InstanceMethods
40
52
  # If a Sequel::Model object that supports forme_set is passed,
41
53
  # isolate the inputs so that each form only includes metadata
@@ -139,7 +151,7 @@ class Roda
139
151
 
140
152
  data = data.to_json
141
153
  form.tag(:input, :type=>:hidden, :name=>:_forme_set_data, :value=>data)
142
- form.tag(:input, :type=>:hidden, :name=>:_forme_set_data_hmac, :value=>OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, self.class.opts[:forme_set_hmac_secret], data))
154
+ form.tag(:input, :type=>:hidden, :name=>:_forme_set_data_hmac, :value=>OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, self.class.forme_set_hmac_secret, data))
143
155
  end
144
156
  end
145
157
  end
@@ -152,7 +164,7 @@ class Roda
152
164
 
153
165
  data = data.to_s
154
166
  hmac = hmac.to_s
155
- actual = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, self.class.opts[:forme_set_hmac_secret], data)
167
+ actual = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA512.new, self.class.forme_set_hmac_secret, data)
156
168
  unless Rack::Utils.secure_compare(hmac.ljust(64), actual) && hmac.length == actual.length
157
169
  return _forme_parse_error(:hmac_mismatch, obj)
158
170
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forme
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Evans
@@ -238,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
238
  - !ruby/object:Gem::Version
239
239
  version: '0'
240
240
  requirements: []
241
- rubygems_version: 3.6.9
241
+ rubygems_version: 4.0.20
242
242
  specification_version: 4
243
243
  summary: HTML forms library
244
244
  test_files: []