eac_ruby_utils 0.97.0 → 0.100.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/eac_ruby_utils/listable/list.rb +9 -1
- data/lib/eac_ruby_utils/listable/value.rb +5 -0
- data/lib/eac_ruby_utils/patches/addressable/uri/query_value.rb +37 -0
- data/lib/eac_ruby_utils/patches/addressable/uri.rb +4 -0
- data/lib/eac_ruby_utils/patches/addressable.rb +4 -0
- data/lib/eac_ruby_utils/patches/object/debug.rb +17 -2
- data/lib/eac_ruby_utils/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f852b958cf7ed8f6f05d3860d738de716c1c5a7456917b4705abf4ab78b546
|
4
|
+
data.tar.gz: ea80e22f5fec3c6d5958a544a348790a01491490dc0f75ac98d8d59b88955122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b9be95919c93a7b3800d726bb52055c9ecfe92b422601af67cc7ad50bbd0a6602d0d92d120759ad408661201040512545286fc376832031f594e46ea1d7d121
|
7
|
+
data.tar.gz: 50674addc08d99c21ffcd2160a8beeb0418f49bd1bd6b2a815544179495b8fce3b4e33fb98074ab530a8def5052db2022048d758943afff3ade8855a3d6bc512
|
@@ -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
|
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)
|
@@ -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
|
@@ -1,18 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class Object
|
4
|
-
def pretty_debug
|
4
|
+
def pretty_debug(options = {})
|
5
|
+
print_debug_title(options)
|
6
|
+
|
5
7
|
STDERR.write(pretty_inspect)
|
6
8
|
|
7
9
|
self
|
8
10
|
end
|
9
11
|
|
10
|
-
def print_debug
|
12
|
+
def print_debug(options = {})
|
13
|
+
print_debug_title(options)
|
11
14
|
STDERR.write(to_debug + "\n")
|
12
15
|
|
13
16
|
self
|
14
17
|
end
|
15
18
|
|
19
|
+
def print_debug_title(title)
|
20
|
+
if title.is_a?(::Hash)
|
21
|
+
return unless title[:title]
|
22
|
+
|
23
|
+
title = title[:title]
|
24
|
+
end
|
25
|
+
char = '='
|
26
|
+
STDERR.write(char * (4 + title.length) + "\n")
|
27
|
+
STDERR.write("#{char} #{title} #{char}\n")
|
28
|
+
STDERR.write(char * (4 + title.length) + "\n")
|
29
|
+
end
|
30
|
+
|
16
31
|
def to_debug
|
17
32
|
"|#{::Object.instance_method(:to_s).bind(self).call}|#{self}|"
|
18
33
|
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.
|
4
|
+
version: 0.100.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-08-
|
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
|