padrino-helpers 0.14.0.rc1 → 0.14.0.rc2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 43d09f356d574dade9184047d8cfea562f7c05dc
|
4
|
+
data.tar.gz: e22cdc11c645e69234b352533d57f1d178f933fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb80bdd1e58b3f2f53509ca8d4bae186a4a75799c2f4e191ebccffbe7325364b7d25fac93f6a9ff4360709972759fd12cc4b043f333e1bae4343b12731b1a595
|
7
|
+
data.tar.gz: 7e3506a11a695b0755abc1e5f8bf892566ee2bcb8e0b55146f78c4d0b24226bf572cf327ffdc91918e985f9adddc9165936ce13acf36b56db3f9552961c36dc1
|
@@ -90,7 +90,7 @@ module Padrino
|
|
90
90
|
# Attempts to pluralize the singular word unless count is 1. If plural is supplied, it will use that when count is > 1,
|
91
91
|
# otherwise it will use inflector to determine the plural form.
|
92
92
|
#
|
93
|
-
# @param [
|
93
|
+
# @param [Integer] count
|
94
94
|
# The count which determines pluralization.
|
95
95
|
# @param [String] singular
|
96
96
|
# The word to be pluralized if appropriate based on +count+.
|
@@ -114,7 +114,7 @@ module Padrino
|
|
114
114
|
# The text to be truncated.
|
115
115
|
# @param [Hash] options
|
116
116
|
# Formatting options for the truncation.
|
117
|
-
# @option options [
|
117
|
+
# @option options [Integer] :length (30)
|
118
118
|
# The number of characters before truncation occurs.
|
119
119
|
# @option options [String] :omission ("...")
|
120
120
|
# The characters that are placed after the truncated text.
|
@@ -141,7 +141,7 @@ module Padrino
|
|
141
141
|
# The text to be truncated.
|
142
142
|
# @param [Hash] options
|
143
143
|
# Formatting options for the truncation.
|
144
|
-
# @option options [
|
144
|
+
# @option options [Integer] :length (30)
|
145
145
|
# The number of words before truncation occurs.
|
146
146
|
# @option options [String] :omission ("...")
|
147
147
|
# The characters that are placed after the truncated text.
|
@@ -168,7 +168,7 @@ module Padrino
|
|
168
168
|
# The text to be wrapped.
|
169
169
|
# @param [Hash] options
|
170
170
|
# Formatting options for the wrapping.
|
171
|
-
# @option options [
|
171
|
+
# @option options [Integer] :line_width (80)
|
172
172
|
# The line width before a wrap should occur.
|
173
173
|
#
|
174
174
|
# @return [String] The text with line wraps for lines longer then +line_width+.
|
@@ -16,7 +16,7 @@ module Padrino
|
|
16
16
|
# Currency value to format.
|
17
17
|
# @param [Hash] options
|
18
18
|
# Options for currency conversion.
|
19
|
-
# @option options [
|
19
|
+
# @option options [Integer] :precision (2)
|
20
20
|
# Sets the level of precision.
|
21
21
|
# @option options [String] :unit ("$")
|
22
22
|
# Sets the denomination of the currency.
|
@@ -69,11 +69,11 @@ module Padrino
|
|
69
69
|
# Formats a +number+ as a percentage string (e.g., 65%). You can customize the
|
70
70
|
# format in the +options+ hash.
|
71
71
|
#
|
72
|
-
# @param [
|
72
|
+
# @param [Integer, Float] number
|
73
73
|
# Percentage value to format.
|
74
74
|
# @param [Hash] options
|
75
75
|
# Options for percentage conversion.
|
76
|
-
# @option options [
|
76
|
+
# @option options [Integer] :precision (3)
|
77
77
|
# Sets the level of precision.
|
78
78
|
# @option options [String] :separator (".")
|
79
79
|
# Sets the separator between the units.
|
@@ -114,7 +114,7 @@ module Padrino
|
|
114
114
|
# customize the format in the +options+ hash.
|
115
115
|
#
|
116
116
|
# @overload number_with_delimiter(number, options={})
|
117
|
-
# @param [
|
117
|
+
# @param [Integer, Float] number
|
118
118
|
# Number value to format.
|
119
119
|
# @param [Hash] options
|
120
120
|
# Options for formatter.
|
@@ -155,11 +155,11 @@ module Padrino
|
|
155
155
|
# You can customize the format in the +options+ hash.
|
156
156
|
#
|
157
157
|
# @overload number_with_precision(number, options={})
|
158
|
-
# @param [
|
158
|
+
# @param [Integer, Float] number
|
159
159
|
# Number value to format.
|
160
160
|
# @param [Hash] options
|
161
161
|
# Options for formatter.
|
162
|
-
# @option options [
|
162
|
+
# @option options [Integer] :precision (3)
|
163
163
|
# Sets the level of precision.
|
164
164
|
# @option options [String] :separator (".")
|
165
165
|
# Sets the separator between the units.
|
@@ -210,11 +210,11 @@ module Padrino
|
|
210
210
|
#
|
211
211
|
#
|
212
212
|
# @overload number_to_human_size(number, options={})
|
213
|
-
# @param [
|
213
|
+
# @param [Integer] number
|
214
214
|
# Number value to format.
|
215
215
|
# @param [Hash] options
|
216
216
|
# Options for formatter.
|
217
|
-
# @option options [
|
217
|
+
# @option options [Integer] :precision (1)
|
218
218
|
# Sets the level of precision.
|
219
219
|
# @option options [String] :separator (".")
|
220
220
|
# Sets the separator between the units.
|
data/test/test_number_helpers.rb
CHANGED
@@ -28,7 +28,7 @@ describe "NumberHelpers" do
|
|
28
28
|
it 'should display number_to_currency' do
|
29
29
|
assert_equal "$1,234,567,890.50", number_to_currency(1234567890.50)
|
30
30
|
assert_equal "$1,234,567,890.51", number_to_currency(1234567890.506)
|
31
|
-
assert_equal "$1,234,567,892", number_to_currency(1234567891.
|
31
|
+
assert_equal "$1,234,567,892", number_to_currency(1234567891.60, {:precision => 0})
|
32
32
|
assert_equal "$1,234,567,890.5", number_to_currency(1234567890.50, {:precision => 1})
|
33
33
|
assert_equal "£1234567890,50", number_to_currency(1234567890.50, {:unit => "£", :separator => ",", :delimiter => ""})
|
34
34
|
assert_equal "$1,234,567,890.50", number_to_currency("1234567890.50")
|
@@ -75,14 +75,12 @@ describe "NumberHelpers" do
|
|
75
75
|
|
76
76
|
it 'should display number_with_precision' do
|
77
77
|
assert_equal "111.235", number_with_precision(111.2346)
|
78
|
-
assert_equal "31.83", number_with_precision(31.825, :precision => 2)
|
79
78
|
assert_equal "111.23", number_with_precision(111.2346, :precision => 2)
|
80
79
|
assert_equal "111.00", number_with_precision(111, :precision => 2)
|
81
80
|
assert_equal "111.235", number_with_precision("111.2346")
|
82
|
-
assert_equal "31.83", number_with_precision("31.825", :precision => 2)
|
83
81
|
assert_equal "3268", number_with_precision((32.6751 * 100.00), :precision => 0)
|
84
|
-
assert_equal "112", number_with_precision(111.
|
85
|
-
assert_equal "1234567892", number_with_precision(1234567891.
|
82
|
+
assert_equal "112", number_with_precision(111.60, :precision => 0)
|
83
|
+
assert_equal "1234567892", number_with_precision(1234567891.60, :precision => 0)
|
86
84
|
|
87
85
|
# Return non-numeric params unchanged.
|
88
86
|
assert_equal "x", number_with_precision("x")
|
@@ -90,8 +88,8 @@ describe "NumberHelpers" do
|
|
90
88
|
end
|
91
89
|
|
92
90
|
it 'should display number_with_precision with custom delimiter and separator' do
|
93
|
-
assert_equal '31,83', number_with_precision(31.
|
94
|
-
assert_equal '1.231,83', number_with_precision(1231.
|
91
|
+
assert_equal '31,83', number_with_precision(31.826, :precision => 2, :separator => ',')
|
92
|
+
assert_equal '1.231,83', number_with_precision(1231.826, :precision => 2, :separator => ',', :delimiter => '.')
|
95
93
|
end
|
96
94
|
|
97
95
|
it 'should display number_to_human_size' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.0.
|
4
|
+
version: 0.14.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-01-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.14.0.
|
22
|
+
version: 0.14.0.rc2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - '='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.14.0.
|
29
|
+
version: 0.14.0.rc2
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: tilt
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|