eac_ruby_utils 0.11.0 → 0.12.0
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 +4 -4
- data/lib/eac_ruby_utils/core_ext.rb +5 -0
- data/lib/eac_ruby_utils/listable/list.rb +13 -0
- data/lib/eac_ruby_utils/patches/module/console_speaker.rb +10 -0
- data/lib/eac_ruby_utils/patches/module/listable.rb +10 -0
- data/lib/eac_ruby_utils/patches/module/patch.rb +9 -0
- data/lib/eac_ruby_utils/patches/module/simple_cache.rb +10 -0
- data/lib/eac_ruby_utils/patches/module.rb +4 -0
- data/lib/eac_ruby_utils/patches/object/if_present.rb +11 -0
- data/lib/eac_ruby_utils/patches.rb +2 -3
- data/lib/eac_ruby_utils/version.rb +1 -1
- data/lib/eac_ruby_utils.rb +1 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b885c805971bcee518de5de56939c08616539d6855742c69e20f70dfd787c552
|
4
|
+
data.tar.gz: 6abd9b7bce1bd9eac4efee4966ffc4b177dea1ddc88e82e613125b79587a68c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4600e778c91f1a038fe457e1afb61ac8a7aba5b23e8c77c166afe8b922c872cecffaa8850f6863eb5e11497fd45c84fcc287df4977e9dd0ddfe3e5dffb6a578
|
7
|
+
data.tar.gz: 1288c11637181bc9fd90cab0be1f9fcefcb9a16562d710676bdb022534835af5e200543df5af7d56f17e636b83f05758cd40d237eb5bf80b8e4f5833d652caec
|
@@ -39,6 +39,19 @@ module EacRubyUtils
|
|
39
39
|
raise "List value unkown: #{v} (Source: #{@lists.source}, Item: #{item})"
|
40
40
|
end
|
41
41
|
|
42
|
+
def value_valid?(value)
|
43
|
+
values.include?(value)
|
44
|
+
end
|
45
|
+
|
46
|
+
def value_validate!(value, error_class = ::StandardError)
|
47
|
+
value_valid?(value) ||
|
48
|
+
raise(error_class, "Invalid value: \"#{value}\" (Valid: #{values_to_s})")
|
49
|
+
end
|
50
|
+
|
51
|
+
def values_to_s
|
52
|
+
values.map { |v| "\"#{v}\"" }.join(', ')
|
53
|
+
end
|
54
|
+
|
42
55
|
private
|
43
56
|
|
44
57
|
def class_i18n_key
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'active_support/core_ext/object/blank'
|
4
|
+
|
5
|
+
class Object
|
6
|
+
# @return +block.call(self)+ if +self+ is present, +default_value+ otherwise.
|
7
|
+
def if_present(default_value = nil)
|
8
|
+
return default_value unless present?
|
9
|
+
block_given? ? yield(self) : self
|
10
|
+
end
|
11
|
+
end
|
data/lib/eac_ruby_utils.rb
CHANGED
@@ -5,6 +5,7 @@ module EacRubyUtils
|
|
5
5
|
require 'eac_ruby_utils/configs'
|
6
6
|
require 'eac_ruby_utils/console'
|
7
7
|
require 'eac_ruby_utils/contextualizable'
|
8
|
+
require 'eac_ruby_utils/core_ext'
|
8
9
|
require 'eac_ruby_utils/envs'
|
9
10
|
require 'eac_ruby_utils/listable'
|
10
11
|
require 'eac_ruby_utils/options_consumer'
|
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.12.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: 2019-
|
11
|
+
date: 2019-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/eac_ruby_utils/console/speaker.rb
|
115
115
|
- lib/eac_ruby_utils/console/speaker/list.rb
|
116
116
|
- lib/eac_ruby_utils/contextualizable.rb
|
117
|
+
- lib/eac_ruby_utils/core_ext.rb
|
117
118
|
- lib/eac_ruby_utils/envs.rb
|
118
119
|
- lib/eac_ruby_utils/envs/base_env.rb
|
119
120
|
- lib/eac_ruby_utils/envs/command.rb
|
@@ -135,8 +136,14 @@ files:
|
|
135
136
|
- lib/eac_ruby_utils/patches/hash.rb
|
136
137
|
- lib/eac_ruby_utils/patches/hash/options_consumer.rb
|
137
138
|
- lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb
|
139
|
+
- lib/eac_ruby_utils/patches/module.rb
|
140
|
+
- lib/eac_ruby_utils/patches/module/console_speaker.rb
|
141
|
+
- lib/eac_ruby_utils/patches/module/listable.rb
|
142
|
+
- lib/eac_ruby_utils/patches/module/patch.rb
|
143
|
+
- lib/eac_ruby_utils/patches/module/simple_cache.rb
|
138
144
|
- lib/eac_ruby_utils/patches/object.rb
|
139
145
|
- lib/eac_ruby_utils/patches/object/asserts.rb
|
146
|
+
- lib/eac_ruby_utils/patches/object/if_present.rb
|
140
147
|
- lib/eac_ruby_utils/paths_hash.rb
|
141
148
|
- lib/eac_ruby_utils/require_sub.rb
|
142
149
|
- lib/eac_ruby_utils/simple_cache.rb
|