eac_ruby_utils 0.96.1 → 0.99.0

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: d4035271ba1a01e74ba0ca6f13d95db76783f67d50d002df5c54c0668a5ec160
4
- data.tar.gz: ab9d27a5d400c1294c0b0fc245f904ac48fb039085f3366a3c69159045e1ebb7
3
+ metadata.gz: 788923b15e15ee32a9ef7b73d99a04cfbc2b6b263bb0277541714267b07ab511
4
+ data.tar.gz: 9a13bab214667dbb9e616d33bfb147ef6c7d8abb0fb9249f6f432f34be6db077
5
5
  SHA512:
6
- metadata.gz: '0830e227136ef0fe56b0ea9e87cd9dfd1c6f5e6e69f6b88f3b51c736ea4305647c3a4fa138417e09bf096d7ba0345aeff8f634fb592f740ee193b68422876189'
7
- data.tar.gz: c989244e994c84f953beda82ed0999b00e91a45b355eb148ce4830a5b85bd43d813d9e886ce70f792e5a5f4e4d833928592242615be333042b096cbb59aff37b
6
+ metadata.gz: b5e8c453a6fcb2d6803f3fd1b7bd41386e9be8e53b74d3dba54892366ede77b279addb98a44030a6ac6b85f3c3781306fd8b8062fe77a4ac8619b8da8ce943f9
7
+ data.tar.gz: 77665df94b421278636db62c478a6b2c2716e42f3661799d1bbebea13f20ca4dcc9753a246fbf47a48866791adf06389173fc2006e01fb69a9b87293b86e5ea6
@@ -29,8 +29,16 @@ module EacRubyUtils
29
29
  @values.values.map(&:value)
30
30
  end
31
31
 
32
+ def values_with_blank
33
+ [blank_value.value] + values
34
+ end
35
+
32
36
  def options
33
- @values.values.map { |v| [v.label, v.value] }
37
+ @values.values.map(&:to_option)
38
+ end
39
+
40
+ def options_with_blank
41
+ [blank_value.to_option] + options
34
42
  end
35
43
 
36
44
  def method_missing(name, *args, &block)
@@ -30,6 +30,11 @@ module EacRubyUtils
30
30
  translate('description')
31
31
  end
32
32
 
33
+ # @return [Array] A two-item array in format `[label, value]`.
34
+ def to_option
35
+ [label, value]
36
+ end
37
+
33
38
  def translation_required?
34
39
  @translation_required
35
40
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'addressable'
4
+
5
+ module Addressable
6
+ class URI
7
+ # @return [ActiveSupport:HashWithIndifferentAccess]
8
+ def hash_query_values
9
+ (query_values || {}).with_indifferent_access
10
+ end
11
+
12
+ def query_value(*args)
13
+ if args.count == 1
14
+ query_value_get(*args)
15
+ elsif args.count == 2
16
+ query_value_set(*args)
17
+ else
18
+ raise ::ArgumentError, "#{object.class}.#{__method__}: wrong number of arguments" \
19
+ " (given #{args.count}, expected 1..2)"
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def query_value_get(name)
26
+ hash_query_values[name]
27
+ end
28
+
29
+ def query_value_set(name, value)
30
+ new_query_values = hash_query_values
31
+ new_query_values[name] = value
32
+ self.query_values = new_query_values
33
+
34
+ self
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/require_sub'
4
+ ::EacRubyUtils.require_sub __FILE__
@@ -20,6 +20,11 @@ module EacRubyUtils
20
20
  raise ::ArgumentError, "String \"#{string}\" does not match pattern \"#{pattern}\""
21
21
  end
22
22
 
23
+ # @return [Boolean]
24
+ def parse?(string)
25
+ internal_parse(string).first
26
+ end
27
+
23
28
  private
24
29
 
25
30
  def internal_parse(string)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRubyUtils
4
- VERSION = '0.96.1'
4
+ VERSION = '0.99.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_ruby_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.96.1
4
+ version: 0.99.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -182,6 +182,9 @@ files:
182
182
  - lib/eac_ruby_utils/options_consumer.rb
183
183
  - lib/eac_ruby_utils/patch.rb
184
184
  - lib/eac_ruby_utils/patches.rb
185
+ - lib/eac_ruby_utils/patches/addressable.rb
186
+ - lib/eac_ruby_utils/patches/addressable/uri.rb
187
+ - lib/eac_ruby_utils/patches/addressable/uri/query_value.rb
185
188
  - lib/eac_ruby_utils/patches/class.rb
186
189
  - lib/eac_ruby_utils/patches/class/abstract.rb
187
190
  - lib/eac_ruby_utils/patches/class/common_constructor.rb