bbk-utils 1.0.1.68971 → 1.0.1.72916
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +29 -6
- data/README.md +9 -0
- data/bin/console +2 -0
- data/lib/bbk/utils/config.rb +197 -180
- data/lib/bbk/utils/crypt.rb +31 -23
- data/lib/bbk/utils/env_helper.rb +74 -69
- data/lib/bbk/utils/log_formatter.rb +15 -8
- data/lib/bbk/utils/logger.rb +33 -30
- data/lib/bbk/utils/proxy_logger.rb +29 -24
- data/lib/bbk/utils/version.rb +6 -1
- data/lib/bbk/utils/xml.rb +31 -20
- data/lib/bbk/utils.rb +7 -1
- data/sig/bbk/config.rbs +55 -0
- data/sig/bbk/crypt.rbs +9 -0
- data/sig/bbk/env_helper.rbs +13 -0
- data/sig/bbk/log_formatter.rbs +10 -0
- data/sig/bbk/logger.rbs +15 -0
- data/sig/bbk/proxy_logger.rbs +16 -0
- data/sig/bbk/proxy_object.rbs +7 -0
- data/sig/bbk/utils.rbs +5 -0
- data/sig/bbk/xml.rbs +10 -0
- data/sig/env.rbs +4 -0
- data/sig/logger.rbs +37 -0
- metadata +59 -6
data/lib/bbk/utils/env_helper.rb
CHANGED
@@ -1,93 +1,98 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'uri'
|
3
4
|
|
4
5
|
module BBK
|
5
|
-
module
|
6
|
-
|
7
|
-
uri = build_uri_with_defaults(env)
|
8
|
-
apply_env_from_uri(env, uri)
|
9
|
-
env
|
10
|
-
end
|
6
|
+
module Utils
|
7
|
+
module EnvHelper
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
def self.prepare_database_envs(env)
|
10
|
+
uri = build_uri_with_defaults(env)
|
11
|
+
apply_env_from_uri(env, uri)
|
12
|
+
env
|
13
|
+
end
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
uri.password = env.fetch('DATABASE_PASS', uri.password)
|
22
|
-
uri.hostname = env.fetch('DATABASE_HOST', uri.hostname) || 'db'
|
23
|
-
uri.port = env.fetch('DATABASE_PORT', uri.port) || 5432
|
15
|
+
def self.prepare_mq_envs(env)
|
16
|
+
apply_mq_env_from_uri(env, build_mq_uri_with_defaults(env))
|
17
|
+
env
|
18
|
+
end
|
24
19
|
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
def self.build_uri_with_defaults(env)
|
21
|
+
::URI.parse(env['DATABASE_URL'] || '').tap do |uri|
|
22
|
+
uri.scheme = env.fetch('DATABASE_ADAPTER', uri.scheme) || 'postgresql'
|
23
|
+
uri.user = env.fetch('DATABASE_USER', uri.user) || 'postgres'
|
24
|
+
uri.password = env.fetch('DATABASE_PASS', uri.password)
|
25
|
+
uri.hostname = env.fetch('DATABASE_HOST', uri.hostname) || 'db'
|
26
|
+
uri.port = env.fetch('DATABASE_PORT', uri.port) || 5432
|
27
|
+
|
28
|
+
name = env.fetch('DATABASE_NAME', uri.path) || ''
|
29
|
+
name = "/#{name}" unless name.start_with?('/')
|
30
|
+
uri.path = name
|
31
|
+
|
32
|
+
if uri.query
|
33
|
+
params = URI.decode_www_form(uri.query).to_h
|
34
|
+
params['pool'] = env.fetch('DATABASE_POOL', params['pool'])
|
35
|
+
uri.query = URI.encode_www_form(params)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.apply_env_from_uri(env, uri)
|
41
|
+
env['DATABASE_URL'] = uri.to_s
|
42
|
+
env['DATABASE_ADAPTER'] = uri.scheme
|
43
|
+
env['DATABASE_USER'] = uri.user
|
44
|
+
env['DATABASE_PASS'] = uri.password
|
45
|
+
env['DATABASE_HOST'] = uri.hostname
|
46
|
+
env['DATABASE_PORT'] = uri.port.to_s
|
47
|
+
env['DATABASE_NAME'] = uri.path[1..-1]
|
28
48
|
|
29
49
|
if uri.query
|
30
50
|
params = URI.decode_www_form(uri.query).to_h
|
31
|
-
|
32
|
-
uri.query = URI.encode_www_form(params)
|
51
|
+
env['DATABASE_POOL'] = params['pool']
|
33
52
|
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.apply_env_from_uri(env, uri)
|
39
|
-
env['DATABASE_URL'] = uri.to_s
|
40
|
-
env['DATABASE_ADAPTER'] = uri.scheme
|
41
|
-
env['DATABASE_USER'] = uri.user
|
42
|
-
env['DATABASE_PASS'] = uri.password
|
43
|
-
env['DATABASE_HOST'] = uri.hostname
|
44
|
-
env['DATABASE_PORT'] = uri.port.to_s
|
45
|
-
env['DATABASE_NAME'] = uri.path[1..-1]
|
46
|
-
|
47
|
-
if uri.query
|
48
|
-
params = URI.decode_www_form(uri.query).to_h
|
49
|
-
env['DATABASE_POOL'] = params['pool']
|
50
53
|
end
|
51
54
|
|
52
|
-
|
55
|
+
def self.build_mq_uri_with_defaults(env)
|
56
|
+
# Only first MQ_URL selected as template if any
|
57
|
+
url = [env.fetch('MQ_URL', '').split(/[;|]/)].flatten.select(&:present?).first || ''
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
59
|
+
# all hosts if form of list fills url template
|
60
|
+
hosts = [env.fetch('MQ_HOST',
|
61
|
+
URI.parse(url).hostname || 'mq').split(/[;|]/)].flatten.select(&:present?).uniq
|
57
62
|
|
58
|
-
|
59
|
-
|
63
|
+
hosts.map do |host|
|
64
|
+
URI.parse(url).tap do |uri|
|
65
|
+
uri.scheme = uri.scheme || 'amqps'
|
66
|
+
uri.hostname = host
|
67
|
+
uri.port = env.fetch('MQ_PORT', uri.port) || 5671
|
68
|
+
uri.user = env.fetch('MQ_USER', uri.user)
|
69
|
+
uri.password = env.fetch('MQ_PASS', uri.password)
|
60
70
|
|
61
|
-
|
62
|
-
|
63
|
-
uri.scheme = uri.scheme || 'amqps'
|
64
|
-
uri.hostname = host
|
65
|
-
uri.port = env.fetch('MQ_PORT', uri.port) || 5671
|
66
|
-
uri.user = env.fetch('MQ_USER', uri.user)
|
67
|
-
uri.password = env.fetch('MQ_PASS', uri.password)
|
71
|
+
vhost = [env.fetch('MQ_VHOST', uri.path), '/'].find(&:present?)
|
72
|
+
vhost = "/#{vhost}" unless vhost.start_with?('/')
|
68
73
|
|
69
|
-
|
70
|
-
|
74
|
+
uri.path = vhost
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
71
78
|
|
72
|
-
|
79
|
+
def self.apply_mq_env_from_uri(env, uris)
|
80
|
+
uri = uris.first
|
81
|
+
|
82
|
+
env['MQ_URL'] = uris.map(&:to_s).join(';')
|
83
|
+
env['MQ_HOST'] = uris.map(&:hostname).join(';')
|
84
|
+
env['MQ_PORT'] = uri.port.to_s
|
85
|
+
env['MQ_PASS'] = uri.password
|
86
|
+
env['MQ_USER'] = uri.user
|
87
|
+
vhost = if uri.path == '/'
|
88
|
+
uri.path
|
89
|
+
else
|
90
|
+
uri.path.gsub(%r{\A/}, '')
|
73
91
|
end
|
92
|
+
env['MQ_VHOST'] = vhost
|
74
93
|
end
|
75
|
-
end
|
76
94
|
|
77
|
-
def self.apply_mq_env_from_uri(env, uris)
|
78
|
-
uri = uris.first
|
79
|
-
|
80
|
-
env['MQ_URL'] = uris.map(&:to_s).join(';')
|
81
|
-
env['MQ_HOST'] = uris.map(&:hostname).join(';')
|
82
|
-
env['MQ_PORT'] = uri.port.to_s
|
83
|
-
env['MQ_PASS'] = uri.password
|
84
|
-
env['MQ_USER'] = uri.user
|
85
|
-
vhost = if uri.path == '/'
|
86
|
-
uri.path
|
87
|
-
else
|
88
|
-
uri.path.gsub(%r{\A/}, '')
|
89
|
-
end
|
90
|
-
env['MQ_VHOST'] = vhost
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|
98
|
+
|
@@ -1,15 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'logger'
|
2
4
|
|
3
5
|
module BBK
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
module Utils
|
7
|
+
class LogFormatter < ::Logger::Formatter
|
8
|
+
|
9
|
+
FORMAT = "%5s [%sUTC #%d] (%s)[%s]: %s\n"
|
10
|
+
def call(severity, time, progname, msg)
|
11
|
+
line = msg2str(msg).gsub("\n", '\\n')
|
12
|
+
format(FORMAT, severity, format_datetime(time.utc), Process.pid, progname, thread_id, line)
|
13
|
+
end
|
14
|
+
|
15
|
+
def thread_id
|
16
|
+
[Thread.current.object_id.to_s, Thread.current.name].compact.join('@')
|
17
|
+
end
|
10
18
|
|
11
|
-
def thread_id
|
12
|
-
[Thread.current.object_id.to_s, Thread.current.name].compact.join('@')
|
13
19
|
end
|
14
20
|
end
|
15
21
|
end
|
22
|
+
|
data/lib/bbk/utils/logger.rb
CHANGED
@@ -5,44 +5,47 @@ require 'active_support/tagged_logging'
|
|
5
5
|
require 'bbk/utils/log_formatter'
|
6
6
|
|
7
7
|
module BBK
|
8
|
-
|
9
|
-
|
10
|
-
DEFAULT_LEVEL = Logger::Severity::DEBUG
|
8
|
+
module Utils
|
9
|
+
class Logger < ::Logger
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
ActiveSupport::TaggedLogging.new(instance)
|
15
|
-
end
|
11
|
+
DEFAULT_NAME = 'bbk'
|
12
|
+
DEFAULT_LEVEL = Logger::Severity::DEBUG
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.progname = progname
|
21
|
-
|
22
|
-
if level.is_a?(Integer)
|
23
|
-
self.level = level
|
24
|
-
else
|
25
|
-
level = level.to_s.upcase
|
26
|
-
level = level.present? ? level : 'INFO'
|
27
|
-
self.level = Logger.const_get(level)
|
14
|
+
def self.new(*args, **kwargs)
|
15
|
+
instance = super
|
16
|
+
ActiveSupport::TaggedLogging.new(instance)
|
28
17
|
end
|
29
18
|
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
def initialize(progname, level, io: STDOUT)
|
20
|
+
io.sync = true
|
21
|
+
super(io)
|
22
|
+
self.progname = progname
|
23
|
+
|
24
|
+
if level.is_a?(Integer)
|
25
|
+
self.level = level
|
26
|
+
else
|
27
|
+
level = level.to_s.upcase
|
28
|
+
level = level.present? ? level : 'INFO'
|
29
|
+
self.level = Logger.const_get(level)
|
30
|
+
end
|
31
|
+
|
32
|
+
self.formatter = LogFormatter.new
|
33
|
+
info "Using LOG_LEVEL=#{level}"
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
36
|
+
def silence(*_args)
|
37
|
+
yield self
|
38
|
+
end
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
@default.level = DEFAULT_LEVEL
|
40
|
+
def self.default
|
41
|
+
unless @default
|
42
|
+
@default = new(DEFAULT_NAME, DEFAULT_LEVEL)
|
43
|
+
@default.level = DEFAULT_LEVEL
|
44
|
+
end
|
44
45
|
@default
|
45
46
|
end
|
47
|
+
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
51
|
+
|
@@ -3,37 +3,42 @@
|
|
3
3
|
require 'bbk/utils/logger'
|
4
4
|
|
5
5
|
module BBK
|
6
|
-
|
7
|
-
|
6
|
+
module Utils
|
7
|
+
class ProxyLogger
|
8
8
|
|
9
|
-
|
10
|
-
@logger = logger
|
11
|
-
@tagged = @logger.respond_to?(:tagged)
|
12
|
-
@tags = [tags].flatten
|
13
|
-
end
|
9
|
+
attr_reader :tags, :logger
|
14
10
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
def initialize(logger, tags:)
|
12
|
+
@logger = logger
|
13
|
+
@tagged = @logger.respond_to?(:tagged)
|
14
|
+
@tags = [tags].flatten
|
15
|
+
end
|
19
16
|
|
20
|
-
|
21
|
-
|
17
|
+
def add_tags(*tags)
|
18
|
+
@tags += tags.flatten
|
19
|
+
@tags = @tags.uniq
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
super unless logger.respond_to?(method)
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if @tagged
|
26
|
+
current_tags = tags - logger.formatter.current_tags
|
27
|
+
logger.tagged(current_tags) { logger.send(method, *args, &block) }
|
28
|
+
else
|
29
|
+
logger.send(method, *args, &block)
|
30
|
+
end
|
28
31
|
end
|
29
|
-
end
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
33
|
+
def respond_to?(name, include_private=false)
|
34
|
+
logger.send(:respond_to?, name, include_private) || super
|
35
|
+
end
|
36
|
+
|
37
|
+
def respond_to_missing?(method_name, include_private = false)
|
38
|
+
logger.send(:respond_to_missing?, method_name, include_private) || super
|
39
|
+
end
|
34
40
|
|
35
|
-
def respond_to_missing?(method_name, include_private = false)
|
36
|
-
logger.send(:respond_to_missing?, method_name, include_private) || super
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
44
|
+
|
data/lib/bbk/utils/version.rb
CHANGED
data/lib/bbk/utils/xml.rb
CHANGED
@@ -1,30 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'securerandom'
|
2
4
|
require 'russian'
|
3
5
|
|
4
6
|
module BBK
|
5
|
-
module
|
6
|
-
|
7
|
+
module Utils
|
8
|
+
module Xml
|
7
9
|
|
8
|
-
|
9
|
-
# Generate identifier to future substitution in XML body. Ex.: real attachment identifier when uploading to FTP
|
10
|
-
def self.build_substitution_id(id)
|
11
|
-
"@{#{id}}"
|
12
|
-
end
|
10
|
+
MTOM_ID_FIRST_LETTERS = %w[a b c d e f].freeze
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
##
|
13
|
+
# Generate identifier to future substitution in XML body. Ex.: real attachment identifier when uploading to FTP
|
14
|
+
def self.build_substitution_id(id)
|
15
|
+
"@{#{id}}"
|
16
|
+
end
|
17
|
+
|
18
|
+
##
|
19
|
+
# Generate uuid compatible with SOAP AttachmentContent identifier
|
20
|
+
def self.generate_mtom_attachment_id
|
21
|
+
id = SecureRandom.uuid
|
22
|
+
id[0] = MTOM_ID_FIRST_LETTERS.sample
|
23
|
+
id
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Normalize XML href to be predictible and constant in various cases
|
28
|
+
def self.normalize_slug(name, href)
|
29
|
+
href_uri = URI.parse(href)
|
30
|
+
href_slug = [href_uri.scheme, href_uri.host, *href_uri.path.split('/'), href_uri.query].select do |item|
|
31
|
+
item.present?
|
32
|
+
end.join('-').gsub(
|
33
|
+
/[.&]/, '-'
|
34
|
+
)
|
35
|
+
Russian.translit "#{name}_#{href_slug}"
|
36
|
+
end
|
21
37
|
|
22
|
-
##
|
23
|
-
# Normalize XML href to be predictible and constant in various cases
|
24
|
-
def self.normalize_slug(name, href)
|
25
|
-
href_uri = URI.parse(href)
|
26
|
-
href_slug = [href_uri.scheme, href_uri.host, *href_uri.path.split('/'), href_uri.query].select(&:present?).join('-').gsub(/[\.&]/, '-')
|
27
|
-
Russian.translit "#{name}_#{href_slug}"
|
28
38
|
end
|
29
39
|
end
|
30
40
|
end
|
41
|
+
|
data/lib/bbk/utils.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'active_support'
|
2
4
|
require 'active_support/core_ext'
|
3
5
|
require 'bbk/utils/config'
|
@@ -10,11 +12,15 @@ require 'bbk/utils/env_helper'
|
|
10
12
|
|
11
13
|
module BBK
|
12
14
|
module Utils
|
15
|
+
|
13
16
|
class << self
|
17
|
+
|
14
18
|
attr_accessor :logger
|
15
19
|
|
16
20
|
end
|
17
21
|
|
18
|
-
self.logger = ::BBK::Logger.default
|
22
|
+
self.logger = ::BBK::Utils::Logger.default
|
23
|
+
|
19
24
|
end
|
20
25
|
end
|
26
|
+
|
data/sig/bbk/config.rbs
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class Config
|
4
|
+
|
5
|
+
class BooleanCaster
|
6
|
+
FALSE_VALUES: Array[bool | Integer | String | Symbol]
|
7
|
+
def self.cast: (untyped value) -> (bool|nil)
|
8
|
+
end
|
9
|
+
|
10
|
+
interface _CallableCaster
|
11
|
+
def call: (String) -> untyped
|
12
|
+
end
|
13
|
+
|
14
|
+
interface _ClassCaster
|
15
|
+
def new: (String) -> untyped
|
16
|
+
end
|
17
|
+
|
18
|
+
type typeCaster = _CallableCaster | _ClassCaster
|
19
|
+
type configItem = {env: String, file: String?, required: bool, desc: String?, bool: bool, value: untyped, default: untyped, type: typeCaster?}
|
20
|
+
type envSource = _ENV | ENVClass
|
21
|
+
|
22
|
+
attr_accessor store: untyped
|
23
|
+
attr_accessor name: String?
|
24
|
+
|
25
|
+
def self.instance: () -> instance
|
26
|
+
|
27
|
+
def initialize: (?String name) -> void
|
28
|
+
def map: (envSource env, String file, ?required: bool, ?desc: String, ?bool: bool, ?key: String) -> void
|
29
|
+
def require: (envSource env, ?desc: String?, ?bool: bool, ?type: typeCaster, ?key: String?) -> void
|
30
|
+
def optional: (envSource env, ?default: untyped, ?desc: String, ?bool: bool, ?type: typeCaster, ?key: String) -> void
|
31
|
+
|
32
|
+
def run!: (?envSource source) -> void
|
33
|
+
def []: (String key) -> untyped
|
34
|
+
def []=: (String key, untyped value) -> void
|
35
|
+
def content: (String key) -> untyped
|
36
|
+
def fetch: (String key, ?untyped default) -> untyped
|
37
|
+
# def to_s: () -> String
|
38
|
+
def as_json: (*untyped) -> Hash[String, untyped]
|
39
|
+
def to_json: (*untyped) -> String
|
40
|
+
def to_yaml: (*untyped) -> String
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def normalize_key: (string key) -> String
|
45
|
+
def process: (envSource source, configItem item) -> void
|
46
|
+
|
47
|
+
def required!: (configItem item) -> void
|
48
|
+
def print_file_item: (configItem item, String padding) -> String
|
49
|
+
def print_item: (configItem item, String padding) -> String
|
50
|
+
def wrap_required: (configItem item) -> String
|
51
|
+
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/sig/bbk/crypt.rbs
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module Crypt
|
4
|
+
def self.full_check: (String key_path, String cert_path, *String cacert_chain) -> Array[String]?
|
5
|
+
def self.valid_key: (String key_path, String cert_path) -> bool
|
6
|
+
def self.valid_cert_sign?: (String cert_path, *String ca_certs_paths) -> bool
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module EnvHelper
|
4
|
+
|
5
|
+
def self.prepare_database_envs: (Hash[String, untyped]|::_ENV env ) -> (Hash[String,untyped]|::_ENV)
|
6
|
+
def self.prepare_mq_envs: (Hash[String, untyped]|::_ENV env) -> (Hash[String, untyped]|::_ENV)
|
7
|
+
def self.build_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> URI::Generic
|
8
|
+
def self.apply_env_from_uri: (Hash[String, untyped]|::_ENV env, URI::Generic uri) -> void
|
9
|
+
def self.build_mq_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> Array[URI::Generic]
|
10
|
+
def self.apply_mq_env_from_uri: (Hash[String, untyped]|::_ENV env, Array[URI::Generic] uris) -> void
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/sig/bbk/logger.rbs
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class Logger < ::Logger
|
4
|
+
|
5
|
+
def self.new: (*untyped) -> _Logger
|
6
|
+
|
7
|
+
def initialize: (String progname, String|Symbol|Integer|nil level, ?io: ::Logger::logdev) -> void
|
8
|
+
|
9
|
+
def silence: (*untyped) { (self) -> untyped } -> untyped
|
10
|
+
|
11
|
+
def self.default: () -> instance
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
class ProxyLogger
|
4
|
+
|
5
|
+
include _ProxyObject
|
6
|
+
|
7
|
+
attr_reader tags: Array[String]
|
8
|
+
attr_reader logger: BBK::Utils::Logger|::_Logger
|
9
|
+
|
10
|
+
def initialize: (BBK::Utils::Logger|::_Logger logger, tags: Array[String?]|String?) -> void
|
11
|
+
|
12
|
+
def add_tags: (*String tags) -> void
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/sig/bbk/utils.rbs
ADDED
data/sig/bbk/xml.rbs
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
module BBK
|
2
|
+
module Utils
|
3
|
+
module Xml
|
4
|
+
MTOM_ID_FIRST_LETTERS: Array[String]
|
5
|
+
def self.build_substituion_id: (string id) -> String
|
6
|
+
def self.generate_mtom_attachment_id: -> String
|
7
|
+
def self.normalize_slug: (String name, String href) -> String
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/sig/env.rbs
ADDED
data/sig/logger.rbs
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
interface _Logger
|
2
|
+
|
3
|
+
def add: (untyped severity, ?untyped message, ?untyped progname) -> untyped
|
4
|
+
|
5
|
+
def close: () -> untyped
|
6
|
+
|
7
|
+
def debug: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
8
|
+
|
9
|
+
def debug!: () -> untyped
|
10
|
+
|
11
|
+
def error: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
12
|
+
|
13
|
+
def error!: () -> untyped
|
14
|
+
|
15
|
+
def fatal: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
16
|
+
|
17
|
+
def fatal!: () -> untyped
|
18
|
+
|
19
|
+
def info: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
20
|
+
|
21
|
+
def info!: () -> untyped
|
22
|
+
|
23
|
+
def info?: () -> untyped
|
24
|
+
|
25
|
+
def level: () -> untyped
|
26
|
+
|
27
|
+
def level=: (untyped severity) -> untyped
|
28
|
+
|
29
|
+
def progname: () -> untyped
|
30
|
+
|
31
|
+
def progname=: (untyped) -> untyped
|
32
|
+
|
33
|
+
def warn: (?untyped progname) { (*untyped) -> untyped } -> untyped
|
34
|
+
|
35
|
+
def warn!: () -> untyped
|
36
|
+
|
37
|
+
end
|