ruby-rails-extensions 2.1.0.pre.rc.7 → 2.1.0.pre.rc.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2f8208756fad0f3e2d3467fe56d7f299ee20d04db7290e6079e2b5f60b9fb2f
|
4
|
+
data.tar.gz: 62d873c62e3d3cfcba37d70c63565d83bf84887d30285f23cf25ca62912cfdb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc3318c549ddeb4cdaa3f7d393dfa26a0d1ff6ad41c0f375fc282e97d5fadfa0d8d82b7518b5ec1624e7272c51a95f536e79d142d1042745ef5bc8e7edae5c04
|
7
|
+
data.tar.gz: 7d1fd81b3578daf91c6e8ca7a495d386773ba2904b6b9b01ecac955ffa10ffbce48338adf589ef3c0f78e9a4ffb0009e886333c7fd8dbe858eb0f33baa52ad24
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Range.class_eval do
|
4
|
+
# Greater than check.
|
5
|
+
#
|
6
|
+
# @param other [Numeric]
|
7
|
+
#
|
8
|
+
# @return [Boolean]
|
9
|
+
#
|
10
|
+
def >(other)
|
11
|
+
self.end > other
|
12
|
+
end
|
13
|
+
|
14
|
+
# Greater than or equal to check.
|
15
|
+
#
|
16
|
+
# @param other [Numeric]
|
17
|
+
#
|
18
|
+
# @return [Boolean]
|
19
|
+
#
|
20
|
+
def >=(other)
|
21
|
+
self.end >= other
|
22
|
+
end
|
23
|
+
|
24
|
+
# Less than to check.
|
25
|
+
#
|
26
|
+
# @param other [Numeric]
|
27
|
+
#
|
28
|
+
# @return [Boolean]
|
29
|
+
#
|
30
|
+
def <(other)
|
31
|
+
self.begin < other
|
32
|
+
end
|
33
|
+
|
34
|
+
# Less than or equal to check.
|
35
|
+
#
|
36
|
+
# @param other [Numeric]
|
37
|
+
#
|
38
|
+
# @return [Boolean]
|
39
|
+
#
|
40
|
+
def <=(other)
|
41
|
+
self.begin <= other
|
42
|
+
end
|
43
|
+
end
|
@@ -43,6 +43,7 @@ module RubyRailsExtensions
|
|
43
43
|
presence_bang
|
44
44
|
quarter_dates
|
45
45
|
range_add
|
46
|
+
range_comparisons
|
46
47
|
range_multiply
|
47
48
|
remove_reserved_keywords
|
48
49
|
safe_parse
|
@@ -110,13 +111,15 @@ module RubyRailsExtensions
|
|
110
111
|
end
|
111
112
|
end
|
112
113
|
|
114
|
+
module_function
|
115
|
+
|
113
116
|
# @return [Configuration]
|
114
|
-
def
|
117
|
+
def configuration
|
115
118
|
@configuration ||= Configuration.new
|
116
119
|
end
|
117
120
|
|
118
121
|
# @yield [Configuration]
|
119
|
-
def
|
122
|
+
def configure
|
120
123
|
yield(configuration)
|
121
124
|
|
122
125
|
Configuration::BOOLEAN_GEMS.each do |extension|
|
@@ -131,5 +134,30 @@ module RubyRailsExtensions
|
|
131
134
|
configuration.flags
|
132
135
|
end
|
133
136
|
|
134
|
-
|
137
|
+
# @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
|
142
|
+
|
143
|
+
nil
|
144
|
+
end
|
145
|
+
|
146
|
+
# @see Object#blank? from active_support/core_ext/object/blank.rb
|
147
|
+
def blank?(item)
|
148
|
+
if item.respond_to?(:blank?)
|
149
|
+
return item.blank?
|
150
|
+
end
|
151
|
+
|
152
|
+
item.respond_to?(:empty?) ? !!item.empty? : !item
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see Object#present? from active_support/core_ext/object/blank.rb
|
156
|
+
def present?(item)
|
157
|
+
if item.respond_to?(:present?)
|
158
|
+
return item.present?
|
159
|
+
end
|
160
|
+
|
161
|
+
!blank?(item)
|
162
|
+
end
|
135
163
|
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.
|
4
|
+
version: 2.1.0.pre.rc.9
|
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-
|
11
|
+
date: 2024-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: benchmark-ips
|
@@ -91,6 +91,7 @@ files:
|
|
91
91
|
- lib/ruby-rails-extensions/extensions/presence_bang.rb
|
92
92
|
- lib/ruby-rails-extensions/extensions/quarter_dates.rb
|
93
93
|
- lib/ruby-rails-extensions/extensions/range_add.rb
|
94
|
+
- lib/ruby-rails-extensions/extensions/range_comparisons.rb
|
94
95
|
- lib/ruby-rails-extensions/extensions/range_multiply.rb
|
95
96
|
- lib/ruby-rails-extensions/extensions/remove_reserved_keywords.rb
|
96
97
|
- lib/ruby-rails-extensions/extensions/safe_parse.rb
|