nrser 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/nrser/log/logger.rb
CHANGED
@@ -9,6 +9,11 @@
|
|
9
9
|
|
10
10
|
require 'semantic_logger'
|
11
11
|
|
12
|
+
# Project / Package
|
13
|
+
# ----------------------------------------------------------------------------
|
14
|
+
|
15
|
+
require 'nrser/functions/text/format'
|
16
|
+
|
12
17
|
|
13
18
|
# Definitions
|
14
19
|
# =======================================================================
|
@@ -38,7 +43,7 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
38
43
|
# @param [NRSER::Log::Logger] logger
|
39
44
|
# The logger to use if the block raises.
|
40
45
|
#
|
41
|
-
# @param [*] on_fail
|
46
|
+
# @param [*] on_fail
|
42
47
|
# Value to return when `&block` raises.
|
43
48
|
#
|
44
49
|
def initialize logger, on_fail: nil
|
@@ -109,7 +114,7 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
109
114
|
# easier to work with than the standard logging methods' multiple valid
|
110
115
|
# argument formats.
|
111
116
|
#
|
112
|
-
# @param [Array]
|
117
|
+
# @param [Array] args
|
113
118
|
# Valid arguments for {SemanticLogger::Logger#debug}, etc. - see notes
|
114
119
|
# above.
|
115
120
|
#
|
@@ -245,13 +250,13 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
245
250
|
# Name of the class, module, or other identifier for which the log messages
|
246
251
|
# are being logged
|
247
252
|
#
|
248
|
-
# @param [nil | Symbol] level
|
253
|
+
# @param [nil | Symbol] level
|
249
254
|
# Only allow log entries of this level or higher to be written to this
|
250
255
|
# appender For example if set to :warn, this appender would only log
|
251
256
|
# `:warn` and `:fatal` log messages when other appenders could be logging
|
252
257
|
# `:info` and lower.
|
253
258
|
#
|
254
|
-
# @param [nil | Regexp | Proc<(SemanticLogger::Log) => Boolean>] filter
|
259
|
+
# @param [nil | Regexp | Proc<(SemanticLogger::Log) => Boolean>] filter
|
255
260
|
# 1. {RegExp}: Only include log messages where the class name matches
|
256
261
|
# the supplied regular expression. All other messages will be
|
257
262
|
# ignored.
|
@@ -377,7 +382,7 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
377
382
|
# what_is_your_favorite_color?
|
378
383
|
# end
|
379
384
|
#
|
380
|
-
# @param
|
385
|
+
# @param [Hash] options
|
381
386
|
# Passed to {Catcher#initialize}.
|
382
387
|
#
|
383
388
|
# @return [Catcher]
|
@@ -400,7 +405,7 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
400
405
|
# @param [Symbol?] level
|
401
406
|
# One of {SemanticLogger::LEVELS} or `nil` to use the global default level.
|
402
407
|
#
|
403
|
-
# @param [Proc<() => RESULT]
|
408
|
+
# @param [Proc<() => RESULT>] block
|
404
409
|
# Block to execute with the `level`.
|
405
410
|
#
|
406
411
|
# @return [RESULT]
|
@@ -416,6 +421,49 @@ class NRSER::Log::Logger < SemanticLogger::Logger
|
|
416
421
|
self.level = prior_level
|
417
422
|
end
|
418
423
|
end
|
424
|
+
|
425
|
+
|
426
|
+
# Let 'em know they done wrong.
|
427
|
+
#
|
428
|
+
# Which is funny, because only I use the library, and probably only I will
|
429
|
+
# ever use this library. So I'm basically nagging my-fucking-self. Sad.
|
430
|
+
#
|
431
|
+
# @param [Array] message
|
432
|
+
# Message segments, formatted with {NRSER.fmt_msg}.
|
433
|
+
#
|
434
|
+
# @param [String] method
|
435
|
+
# Something about what method it is.
|
436
|
+
#
|
437
|
+
# @param [String?] alternative
|
438
|
+
# Optionally (hopefully) something about what I should be using.
|
439
|
+
#
|
440
|
+
# @param [Integer] max_stack_lines
|
441
|
+
# How many lines of the stack to spew out (it can get real big real easy).
|
442
|
+
#
|
443
|
+
# @return [nil]
|
444
|
+
#
|
445
|
+
def deprecated *message, method:, alternative: nil, max_stack_lines: 16
|
446
|
+
kwds = { method: method }
|
447
|
+
|
448
|
+
kwds[:alternative] = alternative if alternative
|
449
|
+
|
450
|
+
if max_stack_lines > 0
|
451
|
+
kwds[:stack] = NRSER::ellipsis \
|
452
|
+
caller,
|
453
|
+
max_stack_lines,
|
454
|
+
omission: '[ ...omitted... ]'
|
455
|
+
end
|
456
|
+
|
457
|
+
if message.empty?
|
458
|
+
message = [ "Method", method, "has been DEPRECIATED" ]
|
459
|
+
else
|
460
|
+
message = [ 'DEPRECIATED:', *message ]
|
461
|
+
end
|
462
|
+
|
463
|
+
warn NRSER.fmt_msg( *message ), **kwds
|
464
|
+
|
465
|
+
nil
|
466
|
+
end # #deprecated
|
419
467
|
|
420
468
|
|
421
469
|
end # class NRSER::Log::Logger
|
data/lib/nrser/log/mixin.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# encoding: UTF-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
+
|
4
5
|
# Definitions
|
5
6
|
# =======================================================================
|
6
7
|
|
@@ -53,7 +54,7 @@ module NRSER::Log::Mixin
|
|
53
54
|
# Instance Methods
|
54
55
|
# ========================================================================
|
55
56
|
|
56
|
-
# Gets the {NRSER::Log
|
57
|
+
# Gets the {NRSER::Log::Logger} for use in the instance. This will be the
|
57
58
|
# class logger from {ClassMethods#logger} unless the instance has a
|
58
59
|
# `#create_logger` method.
|
59
60
|
#
|
data/lib/nrser/log/plugin.rb
CHANGED
@@ -98,23 +98,23 @@ class Plugin
|
|
98
98
|
# Though the logging methods don't use a block at this time, it's there
|
99
99
|
# for completeness and possible futures.
|
100
100
|
#
|
101
|
-
# @param [Symbol] level
|
101
|
+
# @param [Symbol] level
|
102
102
|
# The log level of the call; one of {SemanticLogger::LEVELS}.
|
103
103
|
#
|
104
|
-
# @param [String?] message
|
104
|
+
# @param [String?] message
|
105
105
|
# Log message.
|
106
106
|
#
|
107
|
-
# @param [Hash?] payload
|
107
|
+
# @param [Hash?] payload
|
108
108
|
# Map of names to values to log.
|
109
109
|
#
|
110
|
-
# @param [Object?] exception
|
110
|
+
# @param [Object?] exception
|
111
111
|
# An error to log. This will be an {Exception} in MRI, but *won't* be in
|
112
112
|
# JRuby and possibly other runtimes.
|
113
113
|
#
|
114
|
-
# @param [Object?] metric
|
114
|
+
# @param [Object?] metric
|
115
115
|
# I don't know what this is. I found it in the SemLog code.
|
116
116
|
#
|
117
|
-
# @param [Proc]
|
117
|
+
# @param [Proc] block
|
118
118
|
# Block to pass to the {#logger}'s `level` method. Not currently used
|
119
119
|
# (see note above).
|
120
120
|
#
|
data/lib/nrser/log/types.rb
CHANGED
@@ -40,38 +40,55 @@ module Log
|
|
40
40
|
# it when loading up.
|
41
41
|
#
|
42
42
|
module Types
|
43
|
-
extend
|
43
|
+
extend t::Factory
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
#@!method self.LogLevel **options
|
46
|
+
# A member of {SemanticLogger::LEVELS}.
|
47
|
+
#
|
48
|
+
# @param [Hash] options
|
49
|
+
# Passed to {Type#initialize}.
|
50
|
+
#
|
51
|
+
# @return [Type]
|
52
|
+
#
|
53
|
+
def_type :LogLevel,
|
54
|
+
aliases: [ :level ],
|
55
|
+
from_s: ->( string ) { string.to_sym },
|
56
|
+
&->( **options ) do
|
57
|
+
t.In SemanticLogger::LEVELS, **options
|
58
|
+
end # .LogLevel
|
52
59
|
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
61
|
+
#@!method self.StdIO **options
|
62
|
+
# An {IO} instance with {Type#from_s} mapping:
|
63
|
+
#
|
64
|
+
# '$stdio' -> $stdio
|
65
|
+
# '$stderr' -> $stderr
|
66
|
+
# 'STDOUT' -> STDOUT
|
67
|
+
# 'STDERR' -> STDERR
|
68
|
+
#
|
69
|
+
# @param [Hash] options
|
70
|
+
# Passed to {Type#initialize}.
|
71
|
+
#
|
72
|
+
# @return [Type]
|
73
|
+
#
|
74
|
+
def_type :StdIO,
|
75
|
+
aliases: [ :stdio ],
|
76
|
+
from_s: ->( string ) {
|
77
|
+
case string
|
78
|
+
when '$stdout'
|
79
|
+
$stdout
|
80
|
+
when '$stderr'
|
81
|
+
$stderr
|
82
|
+
when 'STDOUT'
|
83
|
+
STDOUT
|
84
|
+
when 'STDERR'
|
85
|
+
STDERR
|
86
|
+
end
|
87
|
+
},
|
88
|
+
&->( **options ) do
|
89
|
+
t.IsA IO, **options
|
90
|
+
end # .StdIO
|
91
|
+
|
75
92
|
end # module Types
|
76
93
|
|
77
94
|
|
data/lib/nrser/mean_streak.rb
CHANGED
@@ -90,14 +90,6 @@ class NRSER::MeanStreak
|
|
90
90
|
end
|
91
91
|
|
92
92
|
|
93
|
-
# @todo Document parse method.
|
94
|
-
#
|
95
|
-
# @param [type] arg_name
|
96
|
-
# @todo Add name param description.
|
97
|
-
#
|
98
|
-
# @return [return_type]
|
99
|
-
# @todo Document return value.
|
100
|
-
#
|
101
93
|
def parse source, **options
|
102
94
|
NRSER::MeanStreak::Document.parse \
|
103
95
|
source,
|
@@ -47,9 +47,6 @@ class NRSER::MeanStreak::Document
|
|
47
47
|
|
48
48
|
# @todo Document from method.
|
49
49
|
#
|
50
|
-
# @param [type] arg_name
|
51
|
-
# @todo Add name param description.
|
52
|
-
#
|
53
50
|
# @return [NRSER::MeanStreak::Document]
|
54
51
|
# @todo Document return value.
|
55
52
|
#
|
@@ -166,7 +163,7 @@ class NRSER::MeanStreak::Document
|
|
166
163
|
# Computes the *byte* index for a `line` and `column` in the source, both
|
167
164
|
# of which *are in bytes*.
|
168
165
|
#
|
169
|
-
# @param [Integer] line
|
166
|
+
# @param [Integer] line
|
170
167
|
#
|
171
168
|
#
|
172
169
|
def source_byte_index line:, column:
|
data/lib/nrser/message.rb
CHANGED
@@ -76,10 +76,10 @@ module NRSER
|
|
76
76
|
# @param [String | Symbol] symbol
|
77
77
|
# Name of target method.
|
78
78
|
#
|
79
|
-
# @param [Array]
|
79
|
+
# @param [Array] args
|
80
80
|
# Any arguments that should be sent.
|
81
81
|
#
|
82
|
-
# @param [nil | #call]
|
82
|
+
# @param [nil | #call] block
|
83
83
|
# Optional block that should be sent.
|
84
84
|
#
|
85
85
|
def initialize symbol, *args, &block
|
@@ -146,7 +146,7 @@ module NRSER
|
|
146
146
|
# @param [Object] receiver
|
147
147
|
# Object that the message will be sent to.
|
148
148
|
#
|
149
|
-
# @param [Boolean] publicly
|
149
|
+
# @param [Boolean] publicly
|
150
150
|
# When `true`, the message will be sent via {Object#public_send}. This is
|
151
151
|
# the default behavior.
|
152
152
|
#
|
data/lib/nrser/meta/lazy_attr.rb
CHANGED
@@ -63,10 +63,10 @@ class LazyAttr < MethodDecorators::Decorator
|
|
63
63
|
#
|
64
64
|
# It's just `target.receiver`, but the API is how it is.
|
65
65
|
#
|
66
|
-
# @param [Array]
|
66
|
+
# @param [Array] args
|
67
67
|
# Any arguments the decorated method was called with.
|
68
68
|
#
|
69
|
-
# @param [Proc?]
|
69
|
+
# @param [Proc?] block
|
70
70
|
# The block the decorated method was called with (if any).
|
71
71
|
#
|
72
72
|
# @return
|
@@ -56,7 +56,7 @@ class NRSER::Meta::Source::Location < Hamster::Vector
|
|
56
56
|
# @param [Enumerable<Method>] methods
|
57
57
|
# Methods you want the source locations for.
|
58
58
|
#
|
59
|
-
# @param [Boolean] only_valid
|
59
|
+
# @param [Boolean] only_valid
|
60
60
|
# When `true` filter the results to only those that are {#valid?}.
|
61
61
|
#
|
62
62
|
# @return [Hash<Symbol, NRSER::Meta::Source::Location>]
|
data/lib/nrser/props.rb
CHANGED
@@ -1,12 +1,36 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
# Requirements
|
5
|
+
# ========================================================================
|
6
|
+
|
7
|
+
# Project / Package
|
8
|
+
# ------------------------------------------------------------------------
|
9
|
+
|
1
10
|
require_relative './props/class_methods'
|
2
11
|
require_relative './props/instance_methods'
|
3
12
|
|
4
13
|
|
14
|
+
# Refinements
|
15
|
+
# ========================================================================
|
16
|
+
|
5
17
|
require 'nrser/refinements/types'
|
6
18
|
using NRSER::Types
|
7
19
|
|
8
20
|
|
9
|
-
|
21
|
+
# Namespace
|
22
|
+
# ========================================================================
|
23
|
+
|
24
|
+
module NRSER
|
25
|
+
|
26
|
+
|
27
|
+
# Definitions
|
28
|
+
# ========================================================================
|
29
|
+
|
30
|
+
# @todo
|
31
|
+
# This really needs a write-up... but it's not a very simple thing.
|
32
|
+
#
|
33
|
+
module Props
|
10
34
|
DEFAULT_CLASS_KEY = '__class__';
|
11
35
|
|
12
36
|
def self.included base
|
@@ -25,7 +49,8 @@ module NRSER::Props
|
|
25
49
|
# @param [Hash<String, Object>] data
|
26
50
|
# Data hash to load from.
|
27
51
|
#
|
28
|
-
# @param
|
52
|
+
# @param [String] class_key
|
53
|
+
# The key name to look for the class name in.
|
29
54
|
#
|
30
55
|
# @return [NRSER::Props::Props]
|
31
56
|
# Instance of a propertied class.
|
@@ -84,4 +109,10 @@ module NRSER::Props
|
|
84
109
|
klass.from_data data
|
85
110
|
|
86
111
|
end # .UNSAFE_load_instance_from_data
|
87
|
-
end
|
112
|
+
end # module Props
|
113
|
+
|
114
|
+
|
115
|
+
# /Namespace
|
116
|
+
# ========================================================================
|
117
|
+
|
118
|
+
end # module NRSER
|
@@ -69,7 +69,7 @@ module NRSER::Props::InstanceMethods
|
|
69
69
|
# end # #initialize_props
|
70
70
|
|
71
71
|
|
72
|
-
# @param [Proc<(KEY, CURRENT, UPDATE) => VALUE>]
|
72
|
+
# @param [Proc<(KEY, CURRENT, UPDATE) => VALUE>] block
|
73
73
|
# Optional block to handle conflicts.
|
74
74
|
#
|
75
75
|
def merge other, &block
|
@@ -87,10 +87,10 @@ module NRSER::Props::InstanceMethods
|
|
87
87
|
|
88
88
|
# Create a new hash with property names mapped to values.
|
89
89
|
#
|
90
|
-
# @param [Boolean] only_own
|
90
|
+
# @param [Boolean] only_own
|
91
91
|
# When `true`, don't include parent properties.
|
92
92
|
#
|
93
|
-
# @param [Boolean] only_primary
|
93
|
+
# @param [Boolean] only_primary
|
94
94
|
# When `true`, don't include sourced properties.
|
95
95
|
#
|
96
96
|
# @return [Hash<Symbol, Object>]
|
@@ -118,16 +118,16 @@ module NRSER::Props::InstanceMethods
|
|
118
118
|
# supports symbol values, they have poor portability across languages,
|
119
119
|
# and they mean the same thing in this situation.
|
120
120
|
#
|
121
|
-
# @param [Boolean] only_own
|
121
|
+
# @param [Boolean] only_own
|
122
122
|
# When `true`, don't include parent properties.
|
123
123
|
#
|
124
|
-
# @param [Boolean] only_primary
|
124
|
+
# @param [Boolean] only_primary
|
125
125
|
# When `true`, don't include sourced properties.
|
126
126
|
#
|
127
|
-
# @param [Boolean] add_class
|
127
|
+
# @param [Boolean] add_class
|
128
128
|
# Add a special key with the class' name as the value.
|
129
129
|
#
|
130
|
-
# @param [String] class_key
|
130
|
+
# @param [String] class_key
|
131
131
|
# Name for special class key.
|
132
132
|
#
|
133
133
|
# @return [Hash<String, *>]
|
@@ -158,7 +158,7 @@ module NRSER::Props::InstanceMethods
|
|
158
158
|
|
159
159
|
# Get a JSON {String} encoding the instance's data.
|
160
160
|
#
|
161
|
-
# @param [Array]
|
161
|
+
# @param [Array] args
|
162
162
|
# I really don't know. `#to_json` takes at last one argument, but I've
|
163
163
|
# had trouble finding a spec for it :/
|
164
164
|
#
|
@@ -171,7 +171,7 @@ module NRSER::Props::InstanceMethods
|
|
171
171
|
|
172
172
|
# Get a YAML {String} encoding the instance's data.
|
173
173
|
#
|
174
|
-
# @param [Array]
|
174
|
+
# @param [Array] args
|
175
175
|
# I really don't know... whatever {YAML.dump} sends to it i guess.
|
176
176
|
#
|
177
177
|
# @return [String]
|