ruby-rails-extensions 2.1.0.pre.rc.9 → 2.1.0.pre.rc.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2f8208756fad0f3e2d3467fe56d7f299ee20d04db7290e6079e2b5f60b9fb2f
4
- data.tar.gz: 62d873c62e3d3cfcba37d70c63565d83bf84887d30285f23cf25ca62912cfdb9
3
+ metadata.gz: 5b3a4f70a6e3a5dee5a465b1d7e53dc163118c71f8da1b67ef3a9086f7b1ec55
4
+ data.tar.gz: 39feabe026daa75b4e8fd5a3197eae29c18b8c28deacafc845b9f2b26bf8adb0
5
5
  SHA512:
6
- metadata.gz: fc3318c549ddeb4cdaa3f7d393dfa26a0d1ff6ad41c0f375fc282e97d5fadfa0d8d82b7518b5ec1624e7272c51a95f536e79d142d1042745ef5bc8e7edae5c04
7
- data.tar.gz: 7d1fd81b3578daf91c6e8ca7a495d386773ba2904b6b9b01ecac955ffa10ffbce48338adf589ef3c0f78e9a4ffb0009e886333c7fd8dbe858eb0f33baa52ad24
6
+ metadata.gz: c295fea115ef77cebfbd42b3fb1f36631ee040ca9a697630be671e17737dc31b4d4335186ba66defbdca3d795b27f59429cd58c18dea462be1a32600b1ea4bb7
7
+ data.tar.gz: 721b32f34431371b2cad8dd3264b73808262a3447f74d8542bb22c261d638da3ea50f75380bf20a997e0573726227774ef8aa6f213d9c09c7650009dfa8c09d6
data/CHANGELOG.md CHANGED
@@ -10,6 +10,7 @@ Unreleased Changes
10
10
  * `Hash#invert_with_dups`
11
11
  * `FalseClass#to_d` and `TrueClass#to_d`
12
12
  * `Range#>`, `Range#<`, `Range#<=`, `Range#>=`
13
+ * `Range#round`
13
14
 
14
15
  2.0.1 (2024-07-29)
15
16
  ------------------
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ Range.class_eval do
4
+ # Rounds a range. Rounds the beginning and ending values only
5
+ # and creates a new range with the rounded values.
6
+ #
7
+ # @param precision [Integer]
8
+ #
9
+ # @return [Range]
10
+ #
11
+ def round(precision = 0)
12
+ Range.new(self.begin.round(precision), self.end.round(precision), exclude_end?)
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RubyRailsExtensions
4
- VERSION = '2.1.0-rc.9'
4
+ VERSION = '2.1.0-rc.10'
5
5
  end
@@ -45,6 +45,7 @@ module RubyRailsExtensions
45
45
  range_add
46
46
  range_comparisons
47
47
  range_multiply
48
+ range_round
48
49
  remove_reserved_keywords
49
50
  safe_parse
50
51
  select_present
@@ -135,10 +136,8 @@ module RubyRailsExtensions
135
136
  end
136
137
 
137
138
  # @see Object#presence from active_support/core_ext/object/blank.rb
138
- def presence(*items)
139
- items.each do |item|
140
- return item if present?(item)
141
- end
139
+ def presence(item)
140
+ return item if present?(item)
142
141
 
143
142
  nil
144
143
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-rails-extensions
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre.rc.9
4
+ version: 2.1.0.pre.rc.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brands Insurance
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-02 00:00:00.000000000 Z
11
+ date: 2024-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: benchmark-ips
@@ -93,6 +93,7 @@ files:
93
93
  - lib/ruby-rails-extensions/extensions/range_add.rb
94
94
  - lib/ruby-rails-extensions/extensions/range_comparisons.rb
95
95
  - lib/ruby-rails-extensions/extensions/range_multiply.rb
96
+ - lib/ruby-rails-extensions/extensions/range_round.rb
96
97
  - lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
97
98
  - lib/ruby-rails-extensions/extensions/safe_parse.rb
98
99
  - lib/ruby-rails-extensions/extensions/select_present.rb