nrser 0.3.9 → 0.3.10
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/nrser/char/alpha_numeric_sub.rb +9 -19
- data/lib/nrser/char/special.rb +5 -5
- data/lib/nrser/core_ext/array.rb +36 -13
- data/lib/nrser/core_ext/enumerable.rb +1 -0
- data/lib/nrser/core_ext/enumerable/find_map.rb +1 -1
- data/lib/nrser/core_ext/hash/bury.rb +3 -0
- data/lib/nrser/core_ext/hash/extract_values_at.rb +2 -2
- data/lib/nrser/core_ext/method/full_name.rb +1 -1
- data/lib/nrser/core_ext/module/method_objects.rb +1 -1
- data/lib/nrser/core_ext/module/source_locations.rb +27 -15
- data/lib/nrser/core_ext/object/lazy_var.rb +1 -1
- data/lib/nrser/core_ext/pathname.rb +67 -12
- data/lib/nrser/core_ext/pathname/subpath.rb +86 -0
- data/lib/nrser/core_ext/string.rb +28 -1
- data/lib/nrser/core_ext/symbol.rb +11 -12
- data/lib/nrser/errors/README.md +154 -0
- data/lib/nrser/errors/attr_error.rb +146 -53
- data/lib/nrser/errors/count_error.rb +61 -12
- data/lib/nrser/errors/nicer_error.rb +42 -71
- data/lib/nrser/errors/value_error.rb +53 -58
- data/lib/nrser/functions.rb +0 -2
- data/lib/nrser/functions/enumerable.rb +5 -17
- data/lib/nrser/functions/enumerable/associate.rb +14 -5
- data/lib/nrser/functions/enumerable/find_all_map.rb +1 -1
- data/lib/nrser/functions/enumerable/include_slice/array_include_slice.rb +1 -1
- data/lib/nrser/functions/hash/bury.rb +2 -12
- data/lib/nrser/functions/merge_by.rb +2 -2
- data/lib/nrser/functions/module/method_objects.rb +2 -2
- data/lib/nrser/functions/path.rb +185 -165
- data/lib/nrser/functions/path/normalized.rb +84 -0
- data/lib/nrser/functions/string.rb +4 -4
- data/lib/nrser/functions/text/README.md +4 -0
- data/lib/nrser/functions/text/format.rb +53 -0
- data/lib/nrser/functions/text/indentation.rb +6 -6
- data/lib/nrser/functions/text/word_wrap.rb +2 -2
- data/lib/nrser/functions/tree/map_leaves.rb +3 -3
- data/lib/nrser/functions/tree/map_tree.rb +2 -2
- data/lib/nrser/functions/tree/transform.rb +1 -18
- data/lib/nrser/gem_ext/README.md +4 -0
- data/lib/nrser/labs/README.md +8 -0
- data/lib/nrser/labs/config.rb +163 -0
- data/lib/nrser/labs/i8.rb +49 -159
- data/lib/nrser/labs/i8/struct.rb +167 -0
- data/lib/nrser/labs/i8/struct/hash.rb +140 -0
- data/lib/nrser/labs/i8/struct/vector.rb +149 -0
- data/lib/nrser/labs/i8/surjection.rb +211 -0
- data/lib/nrser/labs/lots/consumer.rb +19 -0
- data/lib/nrser/labs/lots/parser.rb +21 -1
- data/lib/nrser/labs/stash.rb +4 -4
- data/lib/nrser/log.rb +25 -21
- data/lib/nrser/log/appender/sync.rb +15 -11
- data/lib/nrser/log/formatters/color.rb +0 -3
- data/lib/nrser/log/formatters/mixin.rb +4 -4
- data/lib/nrser/log/logger.rb +54 -6
- data/lib/nrser/log/mixin.rb +2 -1
- data/lib/nrser/log/plugin.rb +6 -6
- data/lib/nrser/log/types.rb +46 -29
- data/lib/nrser/mean_streak.rb +0 -8
- data/lib/nrser/mean_streak/document.rb +1 -4
- data/lib/nrser/message.rb +3 -3
- data/lib/nrser/meta/README.md +4 -0
- data/lib/nrser/meta/lazy_attr.rb +2 -2
- data/lib/nrser/meta/source/location.rb +1 -1
- data/lib/nrser/props.rb +34 -3
- data/lib/nrser/props/class_methods.rb +2 -1
- data/lib/nrser/props/instance_methods.rb +9 -9
- data/lib/nrser/props/metadata.rb +4 -12
- data/lib/nrser/props/mutable/stash.rb +5 -2
- data/lib/nrser/props/prop.rb +10 -19
- data/lib/nrser/rspex.rb +1 -20
- data/lib/nrser/rspex/example_group/describe_attribute.rb +3 -0
- data/lib/nrser/rspex/example_group/describe_called_with.rb +9 -4
- data/lib/nrser/rspex/example_group/describe_case.rb +1 -0
- data/lib/nrser/rspex/example_group/describe_class.rb +2 -0
- data/lib/nrser/rspex/example_group/describe_group.rb +1 -1
- data/lib/nrser/rspex/example_group/describe_instance.rb +3 -1
- data/lib/nrser/rspex/example_group/describe_message.rb +1 -1
- data/lib/nrser/rspex/example_group/describe_method.rb +64 -30
- data/lib/nrser/rspex/example_group/describe_response_to.rb +1 -1
- data/lib/nrser/rspex/example_group/describe_section.rb +4 -1
- data/lib/nrser/rspex/example_group/describe_sent_to.rb +1 -1
- data/lib/nrser/rspex/example_group/describe_setup.rb +1 -0
- data/lib/nrser/rspex/example_group/describe_source_file.rb +1 -1
- data/lib/nrser/rspex/example_group/describe_spec_file.rb +4 -2
- data/lib/nrser/rspex/example_group/describe_when.rb +2 -1
- data/lib/nrser/rspex/example_group/describe_x.rb +5 -5
- data/lib/nrser/rspex/format.rb +0 -15
- data/lib/nrser/sugar/method_missing_forwarder.rb +3 -3
- data/lib/nrser/sys/env/path.rb +2 -28
- data/lib/nrser/types.rb +63 -12
- data/lib/nrser/types/README.md +76 -0
- data/lib/nrser/types/arrays.rb +192 -137
- data/lib/nrser/types/attributes.rb +269 -0
- data/lib/nrser/types/booleans.rb +134 -83
- data/lib/nrser/types/bounded.rb +110 -47
- data/lib/nrser/types/collections.rb +119 -0
- data/lib/nrser/types/combinators.rb +283 -196
- data/lib/nrser/types/doc/display_table.md +66 -0
- data/lib/nrser/types/eqiuvalent.rb +91 -0
- data/lib/nrser/types/errors/check_error.rb +5 -11
- data/lib/nrser/types/errors/from_string_error.rb +3 -3
- data/lib/nrser/types/factory.rb +287 -20
- data/lib/nrser/types/hashes.rb +227 -179
- data/lib/nrser/types/in.rb +73 -36
- data/lib/nrser/types/is.rb +67 -60
- data/lib/nrser/types/is_a.rb +141 -84
- data/lib/nrser/types/labels.rb +45 -16
- data/lib/nrser/types/maybe.rb +6 -3
- data/lib/nrser/types/nil.rb +64 -27
- data/lib/nrser/types/not.rb +92 -34
- data/lib/nrser/types/numbers.rb +224 -169
- data/lib/nrser/types/pairs.rb +113 -89
- data/lib/nrser/types/paths.rb +250 -137
- data/lib/nrser/types/responds.rb +167 -89
- data/lib/nrser/types/selector.rb +234 -0
- data/lib/nrser/types/shape.rb +136 -65
- data/lib/nrser/types/strings.rb +189 -63
- data/lib/nrser/types/symbols.rb +83 -33
- data/lib/nrser/types/top.rb +89 -0
- data/lib/nrser/types/tuples.rb +134 -98
- data/lib/nrser/types/type.rb +617 -505
- data/lib/nrser/types/when.rb +123 -98
- data/lib/nrser/types/where.rb +182 -91
- data/lib/nrser/version.rb +1 -1
- data/spec/lib/nrser/core_ext/pathname/subpath_spec.rb +22 -0
- data/spec/lib/nrser/errors/attr_error_spec.rb +68 -0
- data/spec/lib/nrser/errors/count_error_spec.rb +69 -0
- data/spec/lib/nrser/functions/path/normalize_path_spec.rb +35 -0
- data/spec/lib/nrser/functions/tree/map_tree_spec.rb +74 -96
- data/spec/lib/nrser/functions/tree/transform_spec.rb +11 -11
- data/spec/lib/nrser/labs/config_spec.rb +22 -0
- data/spec/lib/nrser/labs/i8/struct_spec.rb +39 -0
- data/spec/lib/nrser/types/display_spec.rb +50 -0
- data/spec/lib/nrser/types/paths_spec.rb +16 -10
- data/spec/lib/nrser/types/selector_spec.rb +125 -0
- data/spec/spec_helper.rb +4 -5
- metadata +105 -22
- data/lib/nrser/types/any.rb +0 -41
- data/lib/nrser/types/attrs.rb +0 -213
- data/lib/nrser/types/trees.rb +0 -42
@@ -0,0 +1,211 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
|
5
|
+
# Requirements
|
6
|
+
# =======================================================================
|
7
|
+
|
8
|
+
# Project / Package
|
9
|
+
# -----------------------------------------------------------------------
|
10
|
+
require 'nrser/labs/i8'
|
11
|
+
|
12
|
+
|
13
|
+
# HACK
|
14
|
+
class Object
|
15
|
+
def if proc_able, &block
|
16
|
+
block.call( self ) if proc_able.to_proc.call( self )
|
17
|
+
end
|
18
|
+
|
19
|
+
def unless proc_able, &block
|
20
|
+
block.call( self ) unless proc_able.to_proc.call( self )
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Namespace
|
25
|
+
# ========================================================================
|
26
|
+
|
27
|
+
module I8
|
28
|
+
|
29
|
+
|
30
|
+
# Definitions
|
31
|
+
# =======================================================================
|
32
|
+
|
33
|
+
class Surjection
|
34
|
+
|
35
|
+
include Hamster::Immutable
|
36
|
+
|
37
|
+
|
38
|
+
# Class Methods
|
39
|
+
# ========================================================================
|
40
|
+
|
41
|
+
def self.[] pairs = {}
|
42
|
+
new pairs
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
def self.alloc hash
|
47
|
+
allocate.tap { |instance| instance.instance_variable_set :@hash, hash }
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# Construction
|
52
|
+
# ========================================================================
|
53
|
+
|
54
|
+
def initialize pairs = {}
|
55
|
+
@hash = I8::Hash[
|
56
|
+
pairs.each_with_object( {} ) { |(keys, value), hash|
|
57
|
+
set = I8::Set.new keys
|
58
|
+
if hash.key? value
|
59
|
+
hash[value] |= set
|
60
|
+
else
|
61
|
+
hash[value] = set
|
62
|
+
end
|
63
|
+
}
|
64
|
+
]
|
65
|
+
|
66
|
+
@hash.values.combination( 2 ).each do |a, b|
|
67
|
+
( a & b ).unless( :empty? ) { |intersection|
|
68
|
+
raise NRSER::ConflictError.new \
|
69
|
+
"Sets", a, "and", b, "are not disjoint, sharing", intersection
|
70
|
+
}
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
# Instance Methods
|
76
|
+
# ========================================================================
|
77
|
+
|
78
|
+
def call arg
|
79
|
+
@hash.each { |value, set| return value if set.include?( arg ) }
|
80
|
+
nil
|
81
|
+
end
|
82
|
+
|
83
|
+
# The Ruby hash-ish aliases (as methods for easy subclass overrides)
|
84
|
+
|
85
|
+
# @see #call
|
86
|
+
def get key; call key; end
|
87
|
+
# @see #call
|
88
|
+
def [] key; call key; end
|
89
|
+
|
90
|
+
|
91
|
+
def put arg, value
|
92
|
+
if domain.include?( arg ) && call( arg ) != value
|
93
|
+
raise NRSER::ConflictError.new "Already mapping", arg, "to", call( arg )
|
94
|
+
end
|
95
|
+
|
96
|
+
if value? value
|
97
|
+
# We already have a set of keys mapping to the value
|
98
|
+
if @hash[value].include? arg
|
99
|
+
# And it already has the key, so we can just return this instance
|
100
|
+
self
|
101
|
+
else
|
102
|
+
# The key set we have for the value does not have the key in it.
|
103
|
+
#
|
104
|
+
# We need to
|
105
|
+
#
|
106
|
+
# 1. Create a new hash with the key in the value's key set.
|
107
|
+
# 2. Allocate a new surjection.
|
108
|
+
# 3. set that as it's hash.
|
109
|
+
#
|
110
|
+
self.class.alloc @hash.put( value ) { |set| set.add arg }
|
111
|
+
end
|
112
|
+
else
|
113
|
+
# We don't have a set of keys for that value
|
114
|
+
self.class.alloc @hash.put( value, I8::Set[ arg ] )
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# The standard aliases (as methods for easy subclass overrides)
|
119
|
+
def store *args, █ put *args, █ end
|
120
|
+
|
121
|
+
|
122
|
+
# The domain of the surjection (or "keys" in Ruby-Hash-y lingo).
|
123
|
+
#
|
124
|
+
# @return [I8::Set]
|
125
|
+
#
|
126
|
+
def domain
|
127
|
+
@hash.each_value.reduce I8::Set.empty, :|
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# The Ruby-Hash-y way of finding out if an object is in the {#domain}.
|
132
|
+
#
|
133
|
+
# Functionally the same as `surjection.domain.include? obj`.
|
134
|
+
#
|
135
|
+
# @param [Object] key
|
136
|
+
# @return [Boolean]
|
137
|
+
#
|
138
|
+
def key? key
|
139
|
+
# domain.include? key
|
140
|
+
@hash.each_value.any? { |key_set| key_set.include? key }
|
141
|
+
end
|
142
|
+
|
143
|
+
# The standard aliases (as methods for easy subclass overrides)
|
144
|
+
|
145
|
+
# @see #key?
|
146
|
+
def has_key? key; key? key; end
|
147
|
+
# @see #key?
|
148
|
+
def include? key; key? key; end
|
149
|
+
# @see #key?
|
150
|
+
def member? key; key? key; end
|
151
|
+
|
152
|
+
|
153
|
+
# The codomain of the surjection (or "values" in Ruby-Hash-y lingo).
|
154
|
+
#
|
155
|
+
# @return [I8::Set]
|
156
|
+
#
|
157
|
+
def codomain
|
158
|
+
I8::Set.new @hash.keys
|
159
|
+
end
|
160
|
+
|
161
|
+
# The Ruby-Hash-y name (as a method for easy subclass overrides)
|
162
|
+
|
163
|
+
# @see #codomain
|
164
|
+
def values; codomain; end
|
165
|
+
|
166
|
+
|
167
|
+
# Is `value` in the surjection's {#codomain}?
|
168
|
+
#
|
169
|
+
# @param [Object] value
|
170
|
+
# @return [Boolean]
|
171
|
+
#
|
172
|
+
def value? value
|
173
|
+
@hash.key? value
|
174
|
+
end
|
175
|
+
|
176
|
+
# The standard aliases (as methods for easy subclass overrides)
|
177
|
+
|
178
|
+
# @see #value?
|
179
|
+
def has_value? value; value? value; end
|
180
|
+
|
181
|
+
|
182
|
+
def inspect
|
183
|
+
to_s_with :inspect
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
def to_s
|
188
|
+
to_s_with :to_s
|
189
|
+
end
|
190
|
+
|
191
|
+
|
192
|
+
protected
|
193
|
+
# ========================================================================
|
194
|
+
|
195
|
+
def to_s_with method_name
|
196
|
+
"#{ self.class }[" +
|
197
|
+
@hash.each_pair.map { |value, set|
|
198
|
+
"{#{set.map(&method_name).join(', ')}}=>#{value.send method_name}"
|
199
|
+
}.join( ', ' ) +
|
200
|
+
']'
|
201
|
+
end
|
202
|
+
|
203
|
+
public # end protected ***************************************************
|
204
|
+
|
205
|
+
end # class Surjection
|
206
|
+
|
207
|
+
|
208
|
+
# /Namespace
|
209
|
+
# ========================================================================
|
210
|
+
|
211
|
+
end # module I8
|
@@ -1,6 +1,18 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
|
5
|
+
# Namespace
|
6
|
+
# ========================================================================
|
7
|
+
|
8
|
+
module NRSER
|
9
|
+
module Labs
|
10
|
+
module LOTS
|
11
|
+
|
12
|
+
|
13
|
+
# Definitions
|
14
|
+
# ========================================================================
|
15
|
+
|
4
16
|
class Consumer
|
5
17
|
def initialize
|
6
18
|
@consumed = []
|
@@ -102,3 +114,10 @@ class BoolOptConsumer < Consumer
|
|
102
114
|
|
103
115
|
end # class BoolOptConsumer
|
104
116
|
|
117
|
+
|
118
|
+
# /Namespace
|
119
|
+
# ========================================================================
|
120
|
+
|
121
|
+
end # module LOTS
|
122
|
+
end # module Labs
|
123
|
+
end # module NRSER
|
@@ -1,5 +1,18 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
1
3
|
|
2
4
|
|
5
|
+
# Namespace
|
6
|
+
# ========================================================================
|
7
|
+
|
8
|
+
module NRSER
|
9
|
+
module Labs
|
10
|
+
module LOTS
|
11
|
+
|
12
|
+
|
13
|
+
# Definitions
|
14
|
+
# ========================================================================
|
15
|
+
|
3
16
|
class Parser
|
4
17
|
def initialize consumers:, tokens:
|
5
18
|
@consumers = consumers
|
@@ -7,4 +20,11 @@ class Parser
|
|
7
20
|
end
|
8
21
|
|
9
22
|
|
10
|
-
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# /Namespace
|
26
|
+
# ========================================================================
|
27
|
+
|
28
|
+
end # module LOTS
|
29
|
+
end # module Labs
|
30
|
+
end # module NRSER
|
data/lib/nrser/labs/stash.rb
CHANGED
@@ -46,7 +46,7 @@ class NRSER::Stash < ::Hash
|
|
46
46
|
|
47
47
|
# Save {Hash#[]=} as {#_raw_put} for directly writing keys and values.
|
48
48
|
#
|
49
|
-
#
|
49
|
+
# @!visibility protected
|
50
50
|
#
|
51
51
|
alias_method :_raw_put, :[]=
|
52
52
|
protected :_raw_put
|
@@ -55,7 +55,7 @@ class NRSER::Stash < ::Hash
|
|
55
55
|
# Save {Hash#update} as {#_raw_update} for directly writing many key/value
|
56
56
|
# pairs.
|
57
57
|
#
|
58
|
-
#
|
58
|
+
# @!visibility protected
|
59
59
|
#
|
60
60
|
# @note
|
61
61
|
# This is a hold-over from {HashWithIndifferentAccess}; not currently in
|
@@ -67,7 +67,7 @@ class NRSER::Stash < ::Hash
|
|
67
67
|
|
68
68
|
# Save {Hash#key?} direct querying of key presence.
|
69
69
|
#
|
70
|
-
#
|
70
|
+
# @!visibility protected
|
71
71
|
#
|
72
72
|
alias_method :_raw_key?, :key?
|
73
73
|
protected :_raw_key?
|
@@ -178,7 +178,7 @@ class NRSER::Stash < ::Hash
|
|
178
178
|
# hash_2['key'] = 12
|
179
179
|
# hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22}
|
180
180
|
#
|
181
|
-
# @param [Proc<(KEY, CURRENT, UPDATE) => VALUE>]
|
181
|
+
# @param [Proc<(KEY, CURRENT, UPDATE) => VALUE>] block
|
182
182
|
# Optional block to handle key conflicts.
|
183
183
|
#
|
184
184
|
# @return [self]
|
data/lib/nrser/log.rb
CHANGED
@@ -104,14 +104,6 @@ module NRSER::Log
|
|
104
104
|
# @!group Utility Class Methods
|
105
105
|
# ------------------------------------------------------------------------
|
106
106
|
|
107
|
-
# @todo Document logger_name_and_type method.
|
108
|
-
#
|
109
|
-
# @param [type] arg_name
|
110
|
-
# @todo Add name param description.
|
111
|
-
#
|
112
|
-
# @return [return_type]
|
113
|
-
# @todo Document return value.
|
114
|
-
#
|
115
107
|
def self.logger_type_and_name_from subject
|
116
108
|
case subject
|
117
109
|
when String
|
@@ -184,7 +176,7 @@ module NRSER::Log
|
|
184
176
|
#
|
185
177
|
# @see https://github.com/rocketjob/semantic_logger/blob/97247126de32e6ecbf74cbccaa3b3732768d52c5/lib/semantic_logger/semantic_logger.rb#L454
|
186
178
|
#
|
187
|
-
# @param [Symbol | String | Integer]
|
179
|
+
# @param [Symbol | String | Integer] level
|
188
180
|
# Representation of a level in one of the following formats:
|
189
181
|
#
|
190
182
|
# 1. {Symbol} - verified as member of {SemanticLogger::LEVELS} and
|
@@ -299,7 +291,7 @@ module NRSER::Log
|
|
299
291
|
|
300
292
|
# Try to find a log level in the ENV.
|
301
293
|
#
|
302
|
-
# @param [String | false | nil] prefix
|
294
|
+
# @param [String | false | nil] prefix
|
303
295
|
# The prefix to look under.
|
304
296
|
#
|
305
297
|
# @return [nil]
|
@@ -340,18 +332,30 @@ module NRSER::Log
|
|
340
332
|
# --------------------------------------------------------------------------
|
341
333
|
|
342
334
|
# Setup logging.
|
343
|
-
#
|
344
|
-
# @param [String | false | nil] env_var_prefix
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
# If `nil` (the default), we'll try to use `application` to guess a
|
349
|
-
#
|
350
|
-
#
|
335
|
+
#
|
336
|
+
# @param [String | false | nil] env_var_prefix Prefix to ENV var names to look
|
337
|
+
# for logging setup config under, like `<prefix>_LOG_LEVEL`,
|
338
|
+
# `<prefix>_DEBUG` and `<prefix>_TRACE`.
|
339
|
+
#
|
340
|
+
# If `nil` (the default), we'll try to use `application` to guess a prefix.
|
341
|
+
#
|
351
342
|
# You can disable any ENV lookups by passing `false`.
|
352
|
-
#
|
343
|
+
#
|
344
|
+
# @param [Boolean] sync Enables or disables synchronous logging, where the log
|
345
|
+
# message is processed entirely in the logging thread before the log call
|
346
|
+
# returns.
|
347
|
+
#
|
348
|
+
# {SemanticLogger} offloads log formating and writing to a separate thread
|
349
|
+
# in it's standard configuration, an approach presumably aimed at
|
350
|
+
# performance, but one that can be problematic when logging mutable values
|
351
|
+
# that may change between the log call and the log serialization.
|
352
|
+
#
|
353
|
+
# See
|
354
|
+
# {file:doc/known_issues_and_gotchas/semantic_logger_and_mutable_values.md
|
355
|
+
# SemanticLogger and Mutable Values}.
|
356
|
+
#
|
353
357
|
# @return [nil]
|
354
|
-
#
|
358
|
+
#
|
355
359
|
def self.setup! level: nil,
|
356
360
|
dest: nil,
|
357
361
|
sync: nil,
|
@@ -448,7 +452,7 @@ module NRSER::Log
|
|
448
452
|
# Call {.setup!} with some default keywords that are nice for interactive
|
449
453
|
# session (console/REPL) usage.
|
450
454
|
#
|
451
|
-
# @param [Boolean] add_main_logger
|
455
|
+
# @param [Boolean] add_main_logger
|
452
456
|
# Define a `logger` method at the top level (global) that gets a logger
|
453
457
|
# for the main object.
|
454
458
|
#
|
@@ -69,17 +69,21 @@ class NRSER::Log::Appender::Sync
|
|
69
69
|
|
70
70
|
# Construct a sync appender.
|
71
71
|
#
|
72
|
-
# @param [SemanticLogger]
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
72
|
+
# @param [SemanticLogger::Subscriber] appender
|
73
|
+
# The appender this appender will attempt to append to when there are
|
74
|
+
# pending appendables to append. Apparently.
|
75
|
+
#
|
76
|
+
# Sorry, I just ended up here trying to clear out Yard warnings so I can
|
77
|
+
# maybe figure out why it's all of sudden shitting the bed. Guess I needed
|
78
|
+
# a break.
|
79
|
+
#
|
80
|
+
# In truth I don't even think it needs to be a Subscriber, but that's
|
81
|
+
# probably the easiest way to think about it.
|
82
|
+
#
|
83
|
+
# @param [String] name
|
84
|
+
# Name to use for the log thread and the log name when logging any errors
|
85
|
+
# from this appender.
|
86
|
+
#
|
83
87
|
def initialize appender:, name: appender.class.safe_name
|
84
88
|
@appender = appender
|
85
89
|
end
|
@@ -51,9 +51,6 @@ class NRSER::Log::Formatters::Color < ::SemanticLogger::Formatters::Color
|
|
51
51
|
|
52
52
|
# @todo Document default_color_map method.
|
53
53
|
#
|
54
|
-
# @param [type] arg_name
|
55
|
-
# @todo Add name param description.
|
56
|
-
#
|
57
54
|
# @return [SemanticLogger::Formatters::Color::ColorMap]
|
58
55
|
#
|
59
56
|
def self.default_color_map
|
@@ -160,7 +160,7 @@ module NRSER::Log::Formatters::Mixin
|
|
160
160
|
# # >
|
161
161
|
# # => true
|
162
162
|
#
|
163
|
-
# @param [Array<Symbol>]
|
163
|
+
# @param [Array<Symbol>] tokens
|
164
164
|
# Optional list of token symbols to set as the header format.
|
165
165
|
#
|
166
166
|
# When empty, the method works as a getter, returning the current header
|
@@ -184,7 +184,7 @@ module NRSER::Log::Formatters::Mixin
|
|
184
184
|
#
|
185
185
|
# @see #header
|
186
186
|
#
|
187
|
-
# @param [Array<Symbol>]
|
187
|
+
# @param [Array<Symbol>] tokens
|
188
188
|
# Token symbols to set as the header format.
|
189
189
|
#
|
190
190
|
# @return [HeaderTokens]
|
@@ -202,7 +202,7 @@ module NRSER::Log::Formatters::Mixin
|
|
202
202
|
#
|
203
203
|
# @see #header
|
204
204
|
#
|
205
|
-
# @param [Array<Symbol>]
|
205
|
+
# @param [Array<Symbol>] tokens
|
206
206
|
# When not empty, sets the body to those tokens in that order.
|
207
207
|
#
|
208
208
|
# When empty, the current body is returned.
|
@@ -225,7 +225,7 @@ module NRSER::Log::Formatters::Mixin
|
|
225
225
|
#
|
226
226
|
# @see #header
|
227
227
|
#
|
228
|
-
# @param [Array<Symbol>]
|
228
|
+
# @param [Array<Symbol>] tokens
|
229
229
|
# Token symbols to set as the body format.
|
230
230
|
#
|
231
231
|
# @return [HeaderTokens]
|