nrser 0.2.0.pre.3 → 0.2.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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nrser/ext/enumerable.rb +12 -3
  3. data/lib/nrser/ext/module.rb +62 -0
  4. data/lib/nrser/ext.rb +1 -0
  5. data/lib/nrser/functions/binding.rb +33 -0
  6. data/lib/nrser/functions/enumerable/associate.rb +103 -0
  7. data/lib/nrser/functions/enumerable/map_keys.rb +0 -0
  8. data/lib/nrser/functions/enumerable/map_values.rb +94 -0
  9. data/lib/nrser/functions/enumerable.rb +2 -87
  10. data/lib/nrser/functions/module/methods.rb +206 -0
  11. data/lib/nrser/functions/module/source_locations.rb +213 -0
  12. data/lib/nrser/functions/module.rb +2 -0
  13. data/lib/nrser/functions.rb +1 -0
  14. data/lib/nrser/logging/appender/sync.rb +148 -0
  15. data/lib/nrser/logging/appender.rb +3 -0
  16. data/lib/nrser/logging/formatters/color.rb +165 -0
  17. data/lib/nrser/logging/formatters.rb +1 -0
  18. data/lib/nrser/logging.rb +353 -0
  19. data/lib/nrser/refinements/module.rb +5 -0
  20. data/lib/nrser/refinements.rb +1 -0
  21. data/lib/nrser/rspex/described.rb +99 -0
  22. data/lib/nrser/rspex/example_group/describe_called_with.rb +2 -2
  23. data/lib/nrser/rspex/example_group/describe_class.rb +31 -0
  24. data/lib/nrser/rspex/example_group/describe_instance.rb +1 -1
  25. data/lib/nrser/rspex/example_group/describe_method.rb +40 -0
  26. data/lib/nrser/rspex/example_group.rb +2 -34
  27. data/lib/nrser/rspex/format.rb +19 -6
  28. data/lib/nrser/rspex.rb +1 -1
  29. data/lib/nrser/types/numbers.rb +16 -16
  30. data/lib/nrser/version.rb +1 -1
  31. data/lib/nrser.rb +2 -5
  32. data/spec/design/mapping_spec.rb +42 -0
  33. data/spec/lib/nrser/mean_streak/identity_instance_spec.rb +7 -5
  34. data/spec/spec_helper.rb +23 -105
  35. data/spec/support/shared/types.rb +92 -0
  36. data/spec/support/shared.rb +1 -0
  37. metadata +27 -24
  38. data/lib/nrser/labs/unicode_math.rb +0 -48
  39. data/lib/nrser/labs/where.rb +0 -50
  40. data/lib/nrser/logger.rb +0 -457
  41. data/spec/lib/nrser/logger/dest_spec.rb +0 -15
  42. data/spec/lib/nrser/logger/die_spec.rb +0 -41
  43. data/spec/lib/nrser/logger/install_spec.rb +0 -98
  44. data/spec/lib/nrser/logger/level_int_spec.rb +0 -22
  45. data/spec/lib/nrser/logger/level_name_spec.rb +0 -23
  46. data/spec/lib/nrser/logger/level_sym_spec.rb +0 -22
  47. data/spec/lib/nrser/logger/send_log_spec.rb +0 -63
  48. data/spec/lib/nrser/logger/use_spec.rb +0 -16
@@ -77,16 +77,17 @@ module NRSER::Types
77
77
  # Integer greater than zero.
78
78
  #
79
79
 
80
- POS_INT = intersection(
81
- INT,
82
- bounded(min: 1),
83
- name: 'PosIntType'
84
- ).freeze
85
-
86
80
  def self.pos_int
87
- POS_INT
81
+ intersection(
82
+ INT,
83
+ bounded(min: 1),
84
+ name: 'ℤ⁺'
85
+ ).freeze
88
86
  end
89
87
 
88
+ # Ugh sometimes the naturals have 0, so omit it...
89
+ # singleton_class.send :alias_method, :natural, :pos_int
90
+
90
91
 
91
92
  # Negative Integer
92
93
  # ----------------
@@ -98,7 +99,7 @@ module NRSER::Types
98
99
  intersection(
99
100
  INT,
100
101
  bounded(max: -1),
101
- name: 'NegIntType'
102
+ name: 'ℤ⁻'
102
103
  ).freeze
103
104
  end
104
105
 
@@ -110,20 +111,19 @@ module NRSER::Types
110
111
  # as bounded instead of a union.
111
112
  #
112
113
 
113
- def self.natural **options
114
- intersection INT, bounded(min: 0), name: '', **options
114
+ def self.non_neg_int **options
115
+ # Alternative symbol: 'ℤ⋆'
116
+ intersection INT, bounded(min: 0), name: '{0}∪ℤ⁺', **options
115
117
  end
116
118
 
117
- singleton_class.send :alias_method, :non_neg_int, :natural
118
- singleton_class.send :alias_method, :unsigned, :natural
119
+ singleton_class.send :alias_method, :unsigned, :non_neg_int
119
120
 
120
121
 
121
- def self.natural? **options
122
+ def self.non_neg_int? **options
122
123
  maybe non_neg_int, **options
123
124
  end
124
125
 
125
- singleton_class.send :alias_method, :non_neg_int?, :natural?
126
- singleton_class.send :alias_method, :unsigned?, :natural?
126
+ singleton_class.send :alias_method, :unsigned?, :non_neg_int?
127
127
 
128
128
 
129
129
  # Non-Positive Integer
@@ -133,7 +133,7 @@ module NRSER::Types
133
133
  #
134
134
 
135
135
  def self.non_pos_int **options
136
- intersection INT, bounded(max: 0), name: 'NonPosIntType', **options
136
+ intersection INT, bounded(max: 0), name: '{0}∪ℤ⁻', **options
137
137
  end
138
138
 
139
139
  end # NRSER::Types
data/lib/nrser/version.rb CHANGED
@@ -18,7 +18,7 @@ module NRSER
18
18
  #
19
19
  # @return [String]
20
20
  #
21
- VERSION = "0.2.0.pre.3"
21
+ VERSION = "0.2.0"
22
22
 
23
23
 
24
24
  module Version
data/lib/nrser.rb CHANGED
@@ -20,7 +20,6 @@ require 'singleton'
20
20
  # Deps
21
21
  # -----------------------------------------------------------------------
22
22
  require 'hamster'
23
- require 'semantic_logger'
24
23
 
25
24
 
26
25
  # Hi there!
@@ -47,13 +46,11 @@ require 'semantic_logger'
47
46
  #
48
47
  # Enjoy!
49
48
  #
50
- module NRSER
51
- include SemanticLogger::Loggable
52
- end
53
49
 
54
50
  # 1. Load up version, which has {NRSER::ROOT} in it and depends on nothing
55
- # else
51
+ # else, then logging
56
52
  require_relative './nrser/version'
53
+ require_relative './nrser/logging'
57
54
 
58
55
  # 2. Load up extension mixins first - they don't invoke anything, just define
59
56
  # methods
@@ -0,0 +1,42 @@
1
+ # describe_spec_file(
2
+ # spec_path: __FILE__,
3
+ # description: %{
4
+ # Attempting cohesive design for mapping enums and hashes, mostly to hashes
5
+ # }
6
+ # ) do
7
+ #
8
+ # def as_keys enum, &block
9
+ # if block.nil?
10
+ #
11
+ # else
12
+ # enum.each do |entry|
13
+ # yield [entry, nil]
14
+ # end
15
+ # end
16
+ # end
17
+ #
18
+ # describe "from Enumerable" do
19
+ # describe "|entry| => { entry => MAP(entry) }" do
20
+ # # Should "work" even if enum is hash-like
21
+ # enum.as_keys.map_values { |key| key.attr }
22
+ #
23
+ # # Will work unless enum is hash-like
24
+ # enum.map_values { |key| key.attr }
25
+ # end
26
+ #
27
+ # describe "|entry, nil| => { entry => MAP(key, nil) }" do
28
+ # enum.as_keys.map_values { |key, _| key.attr }
29
+ # end
30
+ # end
31
+ #
32
+ # describe "from Hash" do
33
+ # describe "|key| => { key => MAP(key) }" do
34
+ # enum.map_values { |key| key.attr }
35
+ # end
36
+ #
37
+ # describe "|key, value| => { key => MAP(key, value) }" do
38
+ # enum.map_values { |key, _| entry.attr }
39
+ # end
40
+ # end
41
+ #
42
+ # end # spec file
@@ -11,11 +11,13 @@ describe_spec_file(
11
11
  spec_path: __FILE__,
12
12
  class: NRSER::MeanStreak,
13
13
  ) do
14
- describe_instance do
15
- describe_method :render do
16
- describe_called_with "hey" do
17
- it { is_expected.to eq "hey" }
18
- end # called with "hey"
14
+ describe_class NRSER::MeanStreak do
15
+ describe_instance do
16
+ describe_method :render do
17
+ describe_called_with "hey" do
18
+ it { is_expected.to eq "hey" }
19
+ end # called with "hey"
20
+ end
19
21
  end
20
22
  end
21
23
  end # describe_spec_file
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,29 @@
1
- require 'cmds'
1
+ # Pre
2
+ # ============================================================================
2
3
 
3
4
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
4
5
 
5
- require 'nrser'
6
6
 
7
- require 'nrser/logger'
7
+ # Requirements
8
+ # =======================================================================
9
+
10
+ # Stdlib
11
+ # -----------------------------------------------------------------------
12
+
13
+ # Deps
14
+ # -----------------------------------------------------------------------
15
+ require 'cmds'
16
+
17
+ # Project / Package
18
+ # -----------------------------------------------------------------------
19
+ require 'nrser'
8
20
  require 'nrser/rspex'
9
21
 
22
+ # Local Tree
23
+ # ----------------------------------------------------------------------------
24
+ require_relative './support/shared'
25
+
26
+
10
27
  RSpec.configure do |config|
11
28
  unless ENV['LABS']
12
29
  config.filter_run_excluding labs: true
@@ -23,18 +40,9 @@ module NRSER::TestFixtures
23
40
  end # module NRSER::TestFixtures
24
41
 
25
42
 
26
- MAIN = self
27
-
28
- LOG_LEVELS = {
29
- Logger::DEBUG => [:debug, 'DEBUG'],
30
- Logger::INFO => [:info, 'INFO'],
31
- Logger::WARN => [:warn, 'WARN'],
32
- Logger::ERROR => [:error, 'ERROR'],
33
- Logger::FATAL => [:fatal, 'FATAL'],
34
- Logger::UNKNOWN => [:unknown, 'UNKNOWN'],
35
- }
36
-
37
- BAD_LOG_LEVELS = [:blah, -1, 6, "BLAH"]
43
+ # Was a part of old {NRSER::Logger} testing, keeping for a minute to see if
44
+ # need it again
45
+ # MAIN = self
38
46
 
39
47
 
40
48
  if ENV['DEBUG']
@@ -53,93 +61,3 @@ end
53
61
  def expect_to_not_log &block
54
62
  expect(&block).to_not output.to_stderr_from_any_process
55
63
  end
56
-
57
-
58
- shared_examples "type maker method" do |param_1|
59
- context "provided `name:` option" do
60
- let( :name ) { 'CustomTypeName' }
61
- subject { super().call name: name }
62
-
63
- it { is_expected.to be_a NRSER::Types::Type }
64
- it { is_expected.to have_attributes name: name }
65
- end # provided `name:` option
66
-
67
- end # type maker method
68
-
69
-
70
- shared_examples "make type" do | args: [],
71
- accepts: [],
72
- rejects: [],
73
- to_data: {},
74
- from_s: nil,
75
- **expectations |
76
- context "#call #{ args.map(&:inspect).join ', ' }" do
77
- # Load the type into the subject by applying the parent scope subject,
78
- # which should be the Type maker method that we want to test, to the
79
- # args we received.
80
- subject{ super().call *args }
81
-
82
- # Expect that it's a {NRSER::Types::Type} and any other expectations that
83
- # may have been passed in.
84
- include_examples "expect subject",
85
- { to: { be_a: NRSER::Types::Type } },
86
- *expectations.values
87
-
88
- describe "#test" do
89
- # Make sure it accepts the accepts
90
- accepts.each { |value|
91
- it "accepts #{ value.inspect }" do
92
- expect( subject.test value ).to be true
93
- end
94
- }
95
-
96
- # And that it rejects the rejects
97
- rejects.each { |value|
98
- it "rejects #{ value.inspect }" do
99
- expect( subject.test value ).to be false
100
- end
101
- }
102
- end # #test
103
-
104
- # {NRSER::Types::Type#to_data} tests
105
- to_data.each { |value, data|
106
- it "dumps value #{ value.inspect } to data #{ data.inspect }" do
107
- expect( subject.to_data value ).to eq data
108
- end
109
- }
110
-
111
- # {NRSER::Types::Type.from_s} test
112
- unless from_s.nil?
113
- describe '#from_s' do
114
-
115
- if from_s.key? :accepts
116
- context "accepts" do
117
- from_s[:accepts].each { |s, expected|
118
- describe s.inspect do
119
- subject { super().from_s s }
120
-
121
- it { is_expected.to eq expected }
122
- end
123
- } # each
124
- end # accepts
125
- end
126
-
127
- if from_s.key? :rejects
128
- context "rejects" do
129
- from_s[:rejects].each { |s, error|
130
- describe s.inspect do
131
- it "raises an error" do
132
- expect {
133
- subject.from_s s
134
- }.to raise_error *NRSER.as_array( error )
135
- end # raises an error
136
- end #
137
- }
138
- end # rejects
139
- end
140
-
141
- end # #from_s
142
- end # unless from_s.nil?
143
-
144
- end # #call( ... )
145
- end # Type maker method
@@ -0,0 +1,92 @@
1
+ ##
2
+ # Shared examples and context for testing types
3
+ ##
4
+
5
+ shared_examples "type maker method" do |param_1|
6
+ context "provided `name:` option" do
7
+ let( :name ) { 'CustomTypeName' }
8
+ subject { super().call name: name }
9
+
10
+ it { is_expected.to be_a NRSER::Types::Type }
11
+ it { is_expected.to have_attributes name: name }
12
+ end # provided `name:` option
13
+
14
+ end # type maker method
15
+
16
+
17
+ shared_examples "make type" do | args: [],
18
+ accepts: [],
19
+ rejects: [],
20
+ to_data: {},
21
+ from_s: nil,
22
+ **expectations |
23
+ context "#call #{ args.map(&:inspect).join ', ' }" do
24
+ # Load the type into the subject by applying the parent scope subject,
25
+ # which should be the Type maker method that we want to test, to the
26
+ # args we received.
27
+ subject{ super().call *args }
28
+
29
+ # Expect that it's a {NRSER::Types::Type} and any other expectations that
30
+ # may have been passed in.
31
+ include_examples "expect subject",
32
+ { to: { be_a: NRSER::Types::Type } },
33
+ *expectations.values
34
+
35
+ describe "#test" do
36
+ # Make sure it accepts the accepts
37
+ accepts.each { |value|
38
+ it "accepts #{ value.inspect }" do
39
+ expect( subject.test value ).to be true
40
+ end
41
+ }
42
+
43
+ # And that it rejects the rejects
44
+ rejects.each { |value|
45
+ it "rejects #{ value.inspect }" do
46
+ expect( subject.test value ).to be false
47
+ end
48
+ }
49
+ end # #test
50
+
51
+ # {NRSER::Types::Type#to_data} tests
52
+ to_data.each { |value, data|
53
+ it "dumps value #{ value.inspect } to data #{ data.inspect }" do
54
+ expect( subject.to_data value ).to eq data
55
+ end
56
+ }
57
+
58
+ # {NRSER::Types::Type.from_s} test
59
+ unless from_s.nil?
60
+ describe '#from_s' do
61
+
62
+ if from_s.key? :accepts
63
+ context "accepts" do
64
+ from_s[:accepts].each { |s, expected|
65
+ describe s.inspect do
66
+ subject { super().from_s s }
67
+
68
+ it { is_expected.to eq expected }
69
+ end
70
+ } # each
71
+ end # accepts
72
+ end
73
+
74
+ if from_s.key? :rejects
75
+ context "rejects" do
76
+ from_s[:rejects].each { |s, error|
77
+ describe s.inspect do
78
+ it "raises an error" do
79
+ expect {
80
+ subject.from_s s
81
+ }.to raise_error *NRSER.as_array( error )
82
+ end # raises an error
83
+ end #
84
+ }
85
+ end # rejects
86
+ end
87
+
88
+ end # #from_s
89
+ end # unless from_s.nil?
90
+
91
+ end # #call( ... )
92
+ end # Type maker method
@@ -0,0 +1 @@
1
+ require_relative './shared/types'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nrser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-01 00:00:00.000000000 Z
11
+ date: 2018-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hamster
@@ -228,6 +228,7 @@ files:
228
228
  - lib/nrser/ext.rb
229
229
  - lib/nrser/ext/binding.rb
230
230
  - lib/nrser/ext/enumerable.rb
231
+ - lib/nrser/ext/module.rb
231
232
  - lib/nrser/ext/pathname.rb
232
233
  - lib/nrser/ext/string.rb
233
234
  - lib/nrser/ext/tree.rb
@@ -235,10 +236,13 @@ files:
235
236
  - lib/nrser/functions/array.rb
236
237
  - lib/nrser/functions/binding.rb
237
238
  - lib/nrser/functions/enumerable.rb
239
+ - lib/nrser/functions/enumerable/associate.rb
238
240
  - lib/nrser/functions/enumerable/find_all_map.rb
239
241
  - lib/nrser/functions/enumerable/find_map.rb
240
242
  - lib/nrser/functions/enumerable/include_slice.rb
241
243
  - lib/nrser/functions/enumerable/include_slice/array_include_slice.rb
244
+ - lib/nrser/functions/enumerable/map_keys.rb
245
+ - lib/nrser/functions/enumerable/map_values.rb
242
246
  - lib/nrser/functions/exception.rb
243
247
  - lib/nrser/functions/git.rb
244
248
  - lib/nrser/functions/hash.rb
@@ -251,6 +255,9 @@ files:
251
255
  - lib/nrser/functions/hash/symbolize_keys.rb
252
256
  - lib/nrser/functions/hash/transform_keys.rb
253
257
  - lib/nrser/functions/merge_by.rb
258
+ - lib/nrser/functions/module.rb
259
+ - lib/nrser/functions/module/methods.rb
260
+ - lib/nrser/functions/module/source_locations.rb
254
261
  - lib/nrser/functions/object.rb
255
262
  - lib/nrser/functions/object/as_array.rb
256
263
  - lib/nrser/functions/object/as_hash.rb
@@ -276,9 +283,11 @@ files:
276
283
  - lib/nrser/labs.rb
277
284
  - lib/nrser/labs/globlin.rb
278
285
  - lib/nrser/labs/index.rb
279
- - lib/nrser/labs/unicode_math.rb
280
- - lib/nrser/labs/where.rb
281
- - lib/nrser/logger.rb
286
+ - lib/nrser/logging.rb
287
+ - lib/nrser/logging/appender.rb
288
+ - lib/nrser/logging/appender/sync.rb
289
+ - lib/nrser/logging/formatters.rb
290
+ - lib/nrser/logging/formatters/color.rb
282
291
  - lib/nrser/mean_streak.rb
283
292
  - lib/nrser/mean_streak/document.rb
284
293
  - lib/nrser/message.rb
@@ -294,6 +303,7 @@ files:
294
303
  - lib/nrser/refinements/enumerator.rb
295
304
  - lib/nrser/refinements/exception.rb
296
305
  - lib/nrser/refinements/hash.rb
306
+ - lib/nrser/refinements/module.rb
297
307
  - lib/nrser/refinements/object.rb
298
308
  - lib/nrser/refinements/open_struct.rb
299
309
  - lib/nrser/refinements/pathname.rb
@@ -302,11 +312,14 @@ files:
302
312
  - lib/nrser/refinements/symbol.rb
303
313
  - lib/nrser/refinements/types.rb
304
314
  - lib/nrser/rspex.rb
315
+ - lib/nrser/rspex/described.rb
305
316
  - lib/nrser/rspex/example.rb
306
317
  - lib/nrser/rspex/example_group.rb
307
318
  - lib/nrser/rspex/example_group/describe_called_with.rb
319
+ - lib/nrser/rspex/example_group/describe_class.rb
308
320
  - lib/nrser/rspex/example_group/describe_instance.rb
309
321
  - lib/nrser/rspex/example_group/describe_instance_method.rb
322
+ - lib/nrser/rspex/example_group/describe_method.rb
310
323
  - lib/nrser/rspex/example_group/describe_setup.rb
311
324
  - lib/nrser/rspex/example_group/describe_spec_file.rb
312
325
  - lib/nrser/rspex/example_group/describe_use_case.rb
@@ -342,6 +355,7 @@ files:
342
355
  - lib/nrser/types/when.rb
343
356
  - lib/nrser/types/where.rb
344
357
  - lib/nrser/version.rb
358
+ - spec/design/mapping_spec.rb
345
359
  - spec/lib/nrser/collection/each_spec.rb
346
360
  - spec/lib/nrser/collection/map_spec.rb
347
361
  - spec/lib/nrser/env/path/insert_spec.rb
@@ -376,14 +390,6 @@ files:
376
390
  - spec/lib/nrser/functions/tree/transformer_spec.rb
377
391
  - spec/lib/nrser/labs/globlin_spec.rb
378
392
  - spec/lib/nrser/labs/index_spec.rb
379
- - spec/lib/nrser/logger/dest_spec.rb
380
- - spec/lib/nrser/logger/die_spec.rb
381
- - spec/lib/nrser/logger/install_spec.rb
382
- - spec/lib/nrser/logger/level_int_spec.rb
383
- - spec/lib/nrser/logger/level_name_spec.rb
384
- - spec/lib/nrser/logger/level_sym_spec.rb
385
- - spec/lib/nrser/logger/send_log_spec.rb
386
- - spec/lib/nrser/logger/use_spec.rb
387
393
  - spec/lib/nrser/mean_streak/design_spec.rb
388
394
  - spec/lib/nrser/mean_streak/identity_instance_spec.rb
389
395
  - spec/lib/nrser/meta/class_attrs_spec.rb
@@ -411,7 +417,9 @@ files:
411
417
  - spec/lib/nrser/types_spec.rb
412
418
  - spec/lib/nrser_spec.rb
413
419
  - spec/spec_helper.rb
414
- homepage: https://github.com/nrser/nrser-ruby
420
+ - spec/support/shared.rb
421
+ - spec/support/shared/types.rb
422
+ homepage: https://github.com/nrser/nrser.rb
415
423
  licenses:
416
424
  - MIT
417
425
  metadata: {}
@@ -426,9 +434,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
426
434
  version: 2.3.0
427
435
  required_rubygems_version: !ruby/object:Gem::Requirement
428
436
  requirements:
429
- - - ">"
437
+ - - ">="
430
438
  - !ruby/object:Gem::Version
431
- version: 1.3.1
439
+ version: '0'
432
440
  requirements: []
433
441
  rubyforge_project:
434
442
  rubygems_version: 2.5.2.2
@@ -436,6 +444,7 @@ signing_key:
436
444
  specification_version: 4
437
445
  summary: basic ruby utils i use in a lot of stuff.
438
446
  test_files:
447
+ - spec/design/mapping_spec.rb
439
448
  - spec/lib/nrser/collection/each_spec.rb
440
449
  - spec/lib/nrser/collection/map_spec.rb
441
450
  - spec/lib/nrser/env/path/insert_spec.rb
@@ -470,14 +479,6 @@ test_files:
470
479
  - spec/lib/nrser/functions/tree/transformer_spec.rb
471
480
  - spec/lib/nrser/labs/globlin_spec.rb
472
481
  - spec/lib/nrser/labs/index_spec.rb
473
- - spec/lib/nrser/logger/dest_spec.rb
474
- - spec/lib/nrser/logger/die_spec.rb
475
- - spec/lib/nrser/logger/install_spec.rb
476
- - spec/lib/nrser/logger/level_int_spec.rb
477
- - spec/lib/nrser/logger/level_name_spec.rb
478
- - spec/lib/nrser/logger/level_sym_spec.rb
479
- - spec/lib/nrser/logger/send_log_spec.rb
480
- - spec/lib/nrser/logger/use_spec.rb
481
482
  - spec/lib/nrser/mean_streak/design_spec.rb
482
483
  - spec/lib/nrser/mean_streak/identity_instance_spec.rb
483
484
  - spec/lib/nrser/meta/class_attrs_spec.rb
@@ -505,3 +506,5 @@ test_files:
505
506
  - spec/lib/nrser/types_spec.rb
506
507
  - spec/lib/nrser_spec.rb
507
508
  - spec/spec_helper.rb
509
+ - spec/support/shared/types.rb
510
+ - spec/support/shared.rb
@@ -1,48 +0,0 @@
1
- module NRSER::Labs
2
- module UnicodeMath
3
- SET_STARTS = {
4
- bold: {
5
- upper: '1D400',
6
- lower: '1D41A',
7
- },
8
-
9
- bold_script: {
10
- upper: '1D4D0',
11
- lower: '1D4EA',
12
- },
13
- }
14
-
15
- class CharacterTranslator
16
- def initialize name, upper_start, lower_start
17
- @name = name
18
- @upper_start = upper_start
19
- @lower_start = lower_start
20
- end
21
-
22
- def translate_char char
23
- upper_offset = char.ord - 'A'.ord
24
- lower_offset = char.ord - 'a'.ord
25
-
26
- if upper_offset >= 0 && upper_offset < 26
27
- [ @upper_start.hex + upper_offset ].pack "U"
28
- elsif lower_offset >= 0 && lower_offset < 26
29
- [ @lower_start.hex + lower_offset ].pack "U"
30
- else
31
- char
32
- end
33
- end
34
-
35
- def translate string
36
- string.each_char.map( &method( :translate_char ) ).join
37
- end
38
-
39
- alias_method :[], :translate
40
- end
41
-
42
- def self.[] name
43
- name = name.to_sym
44
- starts = SET_STARTS.fetch name
45
- CharacterTranslator.new name, starts[:upper], starts[:lower]
46
- end
47
- end
48
- end
@@ -1,50 +0,0 @@
1
- # Definitions
2
- # =======================================================================
3
-
4
- module NRSER::Labs
5
-
6
- # A class to hold info about how to find a record (besides by primary key).
7
- #
8
- # Needs to support "template/placeholder"-type information - instructions
9
- # about *how* to find the values to match against depending on a source
10
- # object available later.
11
- #
12
- # @todo
13
- # Not sure if this is the best name... there's already
14
- # {NRSER::Types::Where}...
15
- #
16
- # Maybe this functionality has something to do with the types system?
17
- # It seems like the placeholder stuff would be hard to integrate with
18
- # that, but having a whole other very similar system sucks too.
19
- #
20
- class Where
21
-
22
- # Constants
23
- # ======================================================================
24
-
25
-
26
- # Class Methods
27
- # ======================================================================
28
-
29
-
30
- # Attributes
31
- # ======================================================================
32
-
33
-
34
- # Constructor
35
- # ======================================================================
36
-
37
- # Instantiate a new `Where`.
38
- def initialize
39
-
40
- end # #initialize
41
-
42
-
43
- # Instance Methods
44
- # ======================================================================
45
-
46
-
47
- end # class Where
48
-
49
-
50
- end # module NRSER