psychgus 1.3.6 → 1.3.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01544ac84a4c500d36c933328b920f43bbe878609d10f60c615d6ccccf7ca9da
4
- data.tar.gz: 2856f8d12ebe3881513acfbb4ec8da5af40fd98a35a36b9ec227260643c2193e
3
+ metadata.gz: ffadac29265886dcd2b06d12d45405cb7a204ca891dff23c2d67a5f8cdf2f454
4
+ data.tar.gz: e3648eebf1425c030b6dadfa580a4a41d1ef562b16e652204eb1ec4577e74f5c
5
5
  SHA512:
6
- metadata.gz: d0e41a6e5b84bd23527583e6cbd46db820e8c53e67d241a85e08182770114ee1ee0e57d2b706ca87acd42367fe27001d1de61a67ae9e700211823948ff780c4f
7
- data.tar.gz: 558601409148d719e718a4132f703ad46b06bbb7f19f0ce1d46befd3021051c714a4a6bc0613766ae7d05294f312764b4e1f6b82ba65c13da92a5990210ef136
6
+ metadata.gz: e6b41b74666b0de6f2cde69261f7958b113b4e030d35fe01cae9c11e3dc1a9a5738c777328bdc48497e831d8d8d0008c0e15562ed772487b09fd5cc0a3635283
7
+ data.tar.gz: eaa81c7b6b374aa09c9a959af0d788bdaa86567783eb78fc64e1a49b9d9d5a947a14feaf08912351b6030c5b16efc8de1e91627a000d8936be4165e5db887858
data/.yardopts CHANGED
@@ -1,4 +1,3 @@
1
1
  --files 'LICENSE.txt,CHANGELOG.md'
2
2
  --protected
3
3
  --readme 'README.md'
4
- --title 'Psychgus'
data/CHANGELOG.md CHANGED
@@ -3,8 +3,10 @@
3
3
  - [Keep a Changelog v1.0.0](https://keepachangelog.com/en/1.0.0)
4
4
  - [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html)
5
5
 
6
- ## [Unreleased]
7
- - https://github.com/esotericpig/psychgus/compare/v1.3.6...HEAD
6
+
7
+ ## [v1.3.7] - 2025-05-01
8
+ ### Fixed
9
+ - Fixed up code examples in README and doc.
8
10
 
9
11
 
10
12
  ## [v1.3.6] - 2025-05-01
@@ -15,7 +17,6 @@
15
17
  - Renamed `master` branch to `main`.
16
18
  - Applied RuboCop suggestions.
17
19
  - Refactored tests.
18
- - Removed `yard_ghurt` gem.
19
20
 
20
21
 
21
22
  ## [v1.3.5] - 2024-09-06
data/Gemfile CHANGED
@@ -12,6 +12,7 @@ group(:development,:test) do
12
12
  gem 'rdoc' ,'~> 6.13' # RDoc (*.rb).
13
13
  gem 'redcarpet' ,'~> 3.6' # Markdown (*.md).
14
14
  gem 'yard' ,'~> 0.9' # Doc.
15
+ gem 'yard_ghurt','~> 1.2' # Rake tasks for fixing YARD.
15
16
  end
16
17
 
17
18
  group(:test) do
data/README.md CHANGED
@@ -17,10 +17,7 @@ Turn this YAML...
17
17
  ---
18
18
  Psych Gus:
19
19
  Aliases:
20
- - Longbranch Pennywhistle
21
20
  - Squirts Macintosh
22
- - Clementine Woolysocks
23
- - Lavender Gooms
24
21
  - Big Baby Burton
25
22
  - Chocolate Einstein
26
23
  - MC Clap Yo Handz
@@ -35,8 +32,7 @@ Into this:
35
32
  ```YAML
36
33
  ---
37
34
  Psych Gus:
38
- Aliases: [Longbranch Pennywhistle, Squirts Macintosh, Clementine Woolysocks, Lavender
39
- Gooms, Big Baby Burton, Chocolate Einstein, MC Clap Yo Handz]
35
+ Aliases: [Squirts Macintosh, Big Baby Burton, Chocolate Einstein, MC Clap Yo Handz]
40
36
  Skills: [The Blueberry, The Super Sniffer, Positive Work Attitude]
41
37
  ```
42
38
 
@@ -48,15 +44,12 @@ The Psychgus name comes from the well-styled character Gus from the TV show Psyc
48
44
 
49
45
  - [Setup](#setup)
50
46
  - [Using](#using)
47
+ - [Common Stylers](#common-stylers)
51
48
  - [Simple Example](#simple-example)
52
49
  - [Hash Example](#hash-example)
53
50
  - [Class Example](#class-example)
54
51
  - [Advanced Usage](#advanced-usage)
55
- - [Common Stylers](#common-stylers)
56
- - [Stylers Example](#stylers-example)
57
52
  - [Hacking](#hacking)
58
- - [Testing](#testing)
59
- - [Generating Doc](#generating-doc)
60
53
  - [License](#license)
61
54
 
62
55
  ## Setup
@@ -67,27 +60,24 @@ With the RubyGems CLI package manager:
67
60
 
68
61
  `$ gem install psychgus`
69
62
 
70
- In your *Gemspec* (*<project>.gemspec*):
63
+ In your *.gemspec* file:
71
64
 
72
65
  ```Ruby
73
- # Pick one...
74
66
  spec.add_dependency 'psychgus', '~> X.X.X'
75
- spec.add_development_dependency 'psychgus', '~> X.X.X'
76
67
  ```
77
68
 
78
69
  In your *Gemfile*:
79
70
 
80
71
  ```Ruby
81
72
  # Pick one...
82
- gem 'psychgus', '~> X.X.X'
83
- gem 'psychgus', '~> X.X.X', :group => :development
84
- gem 'psychgus', :git => 'https://github.com/esotericpig/psychgus.git', :tag => 'vX.X.X'
73
+ gem 'psychgus', '~> X.X.X', group: :development
74
+ gem 'psychgus', git: 'https://github.com/esotericpig/psychgus.git', tag: 'vX.X.X'
85
75
  ```
86
76
 
87
77
  Manually:
88
78
 
89
79
  ```
90
- $ git clone 'https://github.com/esotericpig/psychgus.git'
80
+ $ git clone --depth 1 'https://github.com/esotericpig/psychgus.git'
91
81
  $ cd psychgus
92
82
  $ bundle install
93
83
  $ bundle exec rake install:local
@@ -103,13 +93,70 @@ For classes, you can optionally include `Psychgus::Blueberry` and return the sty
103
93
 
104
94
  Instead of making your own styler, you can also use one of the [pre-defined stylers](#common-stylers).
105
95
 
106
- ### Contents | Using
107
-
108
- [Simple Example](#simple-example)
96
+ [Common Stylers](#common-stylers)
97
+ | [Simple Example](#simple-example)
109
98
  | [Hash Example](#hash-example)
110
99
  | [Class Example](#class-example)
111
100
  | [Advanced Usage](#advanced-usage)
112
- | [Common Stylers](#common-stylers)
101
+
102
+ ### Common Stylers
103
+
104
+ A collection of commonly-used [Stylers](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers.html) and [Stylables](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylables.html) are included with Psychgus. They're the easiest & quickest way to get started.
105
+
106
+ | Styler | Description |
107
+ | --- | --- |
108
+ | [CapStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/CapStyler.html) | Capitalizer for Scalars |
109
+ | [FlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/FlowStyler.html) | FLOW style changer for Mappings & Sequences |
110
+ | [MapFlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/MapFlowStyler.html) | FLOW style changer for Mappings only |
111
+ | [NoSymStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/NoSymStyler.html) | Symbol remover for Scalars |
112
+ | [NoTagStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/NoTagStyler.html) | Tag remover for classes |
113
+ | [SeqFlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/SeqFlowStyler.html) | FLOW style changer for Sequences only |
114
+
115
+ Example usage:
116
+
117
+ ```Ruby
118
+ require 'psychgus'
119
+
120
+ class EggCarton
121
+ def initialize
122
+ @eggs = {
123
+ styles: ['fried', 'scrambled', ['BBQ', 'ketchup & mustard']],
124
+ colors: ['brown', 'white', ['blue', 'green']],
125
+ }
126
+ end
127
+ end
128
+
129
+ puts EggCarton.new.to_yaml(
130
+ stylers: [
131
+ Psychgus::NoSymStyler.new,
132
+ Psychgus::NoTagStyler.new,
133
+ Psychgus::CapStyler.new,
134
+ Psychgus::FlowStyler.new(4),
135
+ ]
136
+ )
137
+
138
+ # Output:
139
+ # ---
140
+ # Eggs:
141
+ # Styles: [Fried, Scrambled, [BBQ, Ketchup & Mustard]]
142
+ # Colors: [Brown, White, [Blue, Green]]
143
+
144
+ puts EggCarton.new.to_yaml
145
+
146
+ # Output (without Stylers):
147
+ # --- !ruby/object:EggCarton
148
+ # eggs:
149
+ # :styles:
150
+ # - fried
151
+ # - scrambled
152
+ # - - BBQ
153
+ # - ketchup & mustard
154
+ # :colors:
155
+ # - brown
156
+ # - white
157
+ # - - blue
158
+ # - green
159
+ ```
113
160
 
114
161
  ### Simple Example
115
162
 
@@ -125,8 +172,8 @@ class CoffeeStyler
125
172
  end
126
173
 
127
174
  coffee = {
128
- 'Roast'=>['Light', 'Medium', 'Dark', 'Extra Dark'],
129
- 'Style'=>['Cappuccino', 'Espresso', 'Latte', 'Mocha']
175
+ 'Roast' => ['Light', 'Medium', 'Dark', 'Extra Dark'],
176
+ 'Style' => ['Cappuccino', 'Espresso', 'Latte', 'Mocha'],
130
177
  }
131
178
 
132
179
  puts coffee.to_yaml(stylers: CoffeeStyler.new)
@@ -165,59 +212,54 @@ require 'psychgus'
165
212
  class BurgerStyler
166
213
  include Psychgus::Styler # Mix in methods needed for styling
167
214
 
168
- # Style maps (Psych::Nodes::Mapping)
169
- # - Hashes (key/value pairs)
170
- # - Example: "Burgers: Classic {}"
215
+ # Style hash maps (Psych::Nodes::Mapping).
171
216
  def style_mapping(sniffer,node)
172
217
  node.style = Psychgus::MAPPING_FLOW if sniffer.level >= 4
173
218
  end
174
219
 
175
- # Style scalars (Psych::Nodes::Scalar)
176
- # - Any text (non-alias)
220
+ # Style non-alias text (Psych::Nodes::Scalar).
177
221
  def style_scalar(sniffer,node)
178
- # Remove colon (change symbols into strings)
222
+ # Remove colon (change symbols into strings).
179
223
  node.value = node.value.sub(':','')
180
224
 
181
225
  # Capitalize each word
182
226
  node.value = node.value.split(' ').map do |v|
183
227
  if v.casecmp('BBQ') == 0
184
- v.upcase()
228
+ v.upcase
185
229
  else
186
- v.capitalize()
230
+ v.capitalize
187
231
  end
188
232
  end.join(' ')
189
233
 
190
- # Change lettuce to spinach
234
+ # Change lettuce to spinach.
191
235
  node.value = 'Spinach' if node.value == 'Lettuce'
192
236
  end
193
237
 
194
- # Style sequences (Psych::Nodes::Sequence)
195
- # - Arrays
196
- # - Example: "[Lettuce, Onions, Pickles, Tomatoes]"
238
+ # Style arrays (Psych::Nodes::Sequence).
197
239
  def style_sequence(sniffer,node)
198
240
  node.style = Psychgus::SEQUENCE_FLOW if sniffer.level >= 4
199
241
  end
200
242
  end
201
243
 
202
244
  burgers = {
203
- :burgers => {
204
- :classic => {:sauce => %w(Ketchup Mustard),
205
- :cheese => 'American',
206
- :bun => 'Sesame Seed'},
207
- :bbq => {:sauce => 'Honey BBQ',
208
- :cheese => 'Cheddar',
209
- :bun => 'Kaiser'},
210
- :fancy => {:sauce => 'Spicy Wasabi',
211
- :cheese => 'Smoked Gouda',
212
- :bun => 'Hawaiian'}
245
+ burgers: {
246
+ classic: {sauce: %w[Ketchup Mustard],
247
+ cheese: 'American',
248
+ bun: 'Sesame Seed'},
249
+ bbq: {sauce: 'Honey BBQ',
250
+ cheese: 'Cheddar',
251
+ bun: 'Kaiser'},
252
+ fancy: {sauce: 'Spicy Wasabi',
253
+ cheese: 'Smoked Gouda',
254
+ bun: 'Hawaiian'},
213
255
  },
214
- :toppings => [
256
+ toppings: [
215
257
  'Mushrooms',
216
- %w(Lettuce Onions Pickles Tomatoes),
217
- [%w(Ketchup Mustard), %w(Salt Pepper)]
258
+ %w[Lettuce Onions Pickles Tomatoes],
259
+ [%w[Ketchup Mustard], %w[Salt Pepper]],
218
260
  ]
219
261
  }
220
- burgers[:favorite] = burgers[:burgers][:bbq] # Alias
262
+ burgers[:favorite] = burgers[:burgers][:bbq] # Alias.
221
263
 
222
264
  puts burgers.to_yaml(indent: 3,stylers: BurgerStyler.new)
223
265
 
@@ -234,7 +276,7 @@ puts burgers.to_yaml(indent: 3,stylers: BurgerStyler.new)
234
276
  # Favorite: *1
235
277
 
236
278
  # Or pass in a Hash. Can also dereference aliases.
237
- puts burgers.to_yaml({:indent => 3,:stylers => BurgerStyler.new,:deref_aliases => true})
279
+ puts burgers.to_yaml({indent: 3,stylers: BurgerStyler.new,deref_aliases: true})
238
280
 
239
281
  # Output:
240
282
  # ---
@@ -258,58 +300,53 @@ puts burgers.to_yaml({:indent => 3,:stylers => BurgerStyler.new,:deref_aliases =
258
300
  require 'psychgus'
259
301
 
260
302
  class BurgerStyler
261
- include Psychgus::Styler # Mix in methods needed for styling
303
+ include Psychgus::Styler # Mix in methods needed for styling.
262
304
 
263
305
  def initialize(sniffer)
264
306
  @class_level = sniffer.level
265
307
  @class_position = sniffer.position
266
308
  end
267
309
 
268
- # Style all nodes (Psych::Nodes::Node)
310
+ # Style all nodes (Psych::Nodes::Node).
269
311
  def style(sniffer,node)
270
- # Remove "!ruby/object:..." for Burger classes (not Burgers class)
312
+ # Remove `!ruby/object:...` for Burger classes (not Burgers class).
271
313
  node.tag = nil if node.node_of?(:mapping,:scalar,:sequence)
272
314
 
273
- # This is another way to do the above
315
+ # This is another way to do the above.
274
316
  #node.tag = nil if node.respond_to?(:tag=)
275
317
  end
276
318
 
277
- # Style maps (Psych::Nodes::Mapping)
278
- # - Hashes (key/value pairs)
279
- # - Example: "Burgers: Classic {}"
319
+ # Style hash maps (Psych::Nodes::Mapping).
280
320
  def style_mapping(sniffer,node)
281
321
  parent = sniffer.parent
282
322
 
283
- if !parent.nil?()
323
+ if !parent.nil?
284
324
  # BBQ
285
325
  node.style = Psychgus::MAPPING_FLOW if parent.node_of?(:scalar) &&
286
326
  parent.value.casecmp('BBQ') == 0
287
327
  end
288
328
  end
289
329
 
290
- # Style scalars (Psych::Nodes::Scalar)
291
- # - Any text (non-alias)
330
+ # Style non-alias text (Psych::Nodes::Scalar).
292
331
  def style_scalar(sniffer,node)
293
332
  parent = sniffer.parent
294
333
 
295
- # Single quote scalars that are not keys to a map
296
- # - "child_key?" is the same as "child_type == :key"
297
- node.style = Psychgus::SCALAR_SINGLE_QUOTED unless parent.child_key?()
334
+ # Single quote scalars that are not keys to a map.
335
+ # - `child_key?` is the same as `child_type == :key`
336
+ node.style = Psychgus::SCALAR_SINGLE_QUOTED unless parent.child_key?
298
337
  end
299
338
 
300
- # Style sequences (Psych::Nodes::Sequence)
301
- # - Arrays
302
- # - Example: "[Lettuce, Onions, Pickles, Tomatoes]"
339
+ # Style arrays (Psych::Nodes::Sequence).
303
340
  def style_sequence(sniffer,node)
304
341
  relative_level = (sniffer.level - @class_level) + 1
305
342
 
306
- # "[Ketchup, Mustard]"
343
+ # `[Ketchup, Mustard]`
307
344
  node.style = Psychgus::SEQUENCE_FLOW if relative_level == 3
308
345
  end
309
346
  end
310
347
 
311
348
  class Burger
312
- include Psychgus::Blueberry # Mix in methods needed to be stylable
349
+ include Psychgus::Blueberry # Mix in methods needed to be stylable.
313
350
 
314
351
  attr_accessor :bun
315
352
  attr_accessor :cheese
@@ -321,13 +358,13 @@ class Burger
321
358
  @sauce = sauce
322
359
  end
323
360
 
324
- # Return our styler(s)
361
+ # Return our styler(s).
325
362
  # - Can be an Array: [MyStyler1.new, MyStyler2.new]
326
363
  def psychgus_stylers(sniffer)
327
364
  return BurgerStyler.new(sniffer)
328
365
  end
329
366
 
330
- # You can still use Psych's encode_with(), no problem
367
+ # You can still use Psych's encode_with(), no problem.
331
368
  def encode_with(coder)
332
369
  coder['Bun'] = @bun
333
370
  coder['Cheese'] = @cheese
@@ -340,23 +377,23 @@ class Burgers
340
377
  attr_accessor :toppings
341
378
  attr_accessor :favorite
342
379
 
343
- def initialize()
380
+ def initialize
344
381
  @burgers = {
345
382
  'Classic' => Burger.new(['Ketchup','Mustard'],'American' ,'Sesame Seed'),
346
383
  'BBQ' => Burger.new('Honey BBQ' ,'Cheddar' ,'Kaiser'),
347
- 'Fancy' => Burger.new('Spicy Wasabi' ,'Smoked Gouda','Hawaiian')
384
+ 'Fancy' => Burger.new('Spicy Wasabi' ,'Smoked Gouda','Hawaiian'),
348
385
  }
349
386
 
350
387
  @toppings = [
351
388
  'Mushrooms',
352
- %w(Lettuce Onions Pickles Tomatoes),
353
- [%w(Ketchup Mustard),%w(Salt Pepper)]
389
+ %w[Lettuce Onions Pickles Tomatoes],
390
+ [%w[Ketchup Mustard],%w[Salt Pepper]],
354
391
  ]
355
392
 
356
393
  @favorite = @burgers['BBQ'] # Alias
357
394
  end
358
395
 
359
- # You can still use Psych's encode_with(), no problem
396
+ # You can still use Psych's encode_with(), no problem.
360
397
  def encode_with(coder)
361
398
  coder['Burgers'] = @burgers
362
399
  coder['Toppings'] = @toppings
@@ -393,7 +430,7 @@ puts burgers.to_yaml(indent: 3)
393
430
  # Favorite: *1
394
431
 
395
432
  # Or pass in a Hash. Can also dereference aliases.
396
- puts burgers.to_yaml({:indent => 3,:deref_aliases => true})
433
+ puts burgers.to_yaml({indent: 3,deref_aliases: true})
397
434
 
398
435
  # Output:
399
436
  # --- !ruby/object:Burgers
@@ -438,65 +475,80 @@ end
438
475
 
439
476
  coffee = {
440
477
  'Coffee' => {
441
- 'Roast'=>['Light', 'Medium', 'Dark', 'Extra Dark'],
442
- 'Style'=>['Cappuccino', 'Espresso', 'Latte', 'Mocha']
478
+ 'Roast' => ['Light', 'Medium', 'Dark', 'Extra Dark'],
479
+ 'Style' => ['Cappuccino', 'Espresso', 'Latte', 'Mocha'],
443
480
  }
444
481
  }
445
482
  eggs = {
446
483
  'Eggs' => {
447
- 'Color'=>['Brown', 'White', 'Blue', 'Olive'],
448
- 'Style'=>['Fried', 'Scrambled', 'Omelette', 'Poached']
484
+ 'Color' => ['Brown', 'White', 'Blue', 'Olive'],
485
+ 'Style' => ['Fried', 'Scrambled', 'Omelette', 'Poached'],
449
486
  }
450
487
  }
451
488
 
452
489
  filename = 'coffee-and-eggs.yaml'
453
490
  styler = MyStyler.new
454
- options = {:indentation=>3, :stylers=>styler, :deref_aliases=>true}
491
+ options = {indentation: 3, stylers: styler, deref_aliases: true}
455
492
 
456
- coffee_yaml = coffee.to_yaml(options)
457
- coffee_and_eggs_yaml = Psychgus.dump_stream(coffee,eggs,options)
493
+ coffee_yaml = coffee.to_yaml(**options)
494
+ coffee_and_eggs_yaml = Psychgus.dump_stream(coffee,eggs,**options)
458
495
 
496
+ # High-level emitting.
497
+ puts '+=====================+'
498
+ puts '| High-level emitting |'
499
+ puts '+=====================+'
459
500
 
460
- # High-level emitting
461
- puts Psychgus.dump(coffee,options)
501
+ puts Psychgus.dump(coffee,**options)
462
502
  puts
463
503
 
464
- Psychgus.dump_file(filename,coffee,eggs,options)
504
+ Psychgus.dump_file(filename,coffee,eggs,**options)
465
505
  puts File.readlines(filename)
466
506
  puts
467
507
 
468
- puts Psychgus.dump_stream(coffee,eggs,options)
508
+ puts Psychgus.dump_stream(coffee,eggs,**options)
469
509
  puts
470
510
 
471
- puts coffee.to_yaml(options)
511
+ puts coffee.to_yaml(**options)
472
512
  puts
473
513
 
474
514
  # High-level parsing
475
515
  # - Because to_ruby() will be called, just use Psych:
476
516
  # - load(), load_file(), load_stream(), safe_load()
477
517
 
478
- # Mid-level emitting
479
- stream = Psychgus.parse_stream(coffee_and_eggs_yaml,options)
518
+ # Mid-level emitting.
519
+ puts '+====================+'
520
+ puts '| Mid-level emitting |'
521
+ puts '+====================+'
480
522
 
481
- puts stream.to_yaml()
523
+ stream = Psychgus.parse_stream(coffee_and_eggs_yaml,**options)
524
+
525
+ puts stream.to_yaml
482
526
  puts
483
527
 
484
- # Mid-level parsing
485
- puts Psychgus.parse(coffee_yaml,options).to_ruby
528
+ # Mid-level parsing.
529
+ puts '+===================+'
530
+ puts '| Mid-level parsing |'
531
+ puts '+===================+'
532
+
533
+ puts Psychgus.parse(coffee_yaml,**options).to_ruby
486
534
  puts
487
535
 
488
- puts Psychgus.parse_file(filename,options).to_ruby
536
+ puts Psychgus.parse_file(filename,**options).to_ruby
489
537
  puts
490
538
 
491
539
  i = 0
492
- Psychgus.parse_stream(coffee_and_eggs_yaml,options) do |doc|
540
+ Psychgus.parse_stream(coffee_and_eggs_yaml,**options) do |doc|
493
541
  puts "Doc ##{i += 1}:"
494
542
  puts " #{doc.to_ruby}"
495
543
  end
496
544
  puts
497
545
 
498
- # Low-level emitting
499
- tree_builder = Psychgus::StyledTreeBuilder.new(styler,options)
546
+ # Low-level emitting.
547
+ puts '+====================+'
548
+ puts '| Low-level emitting |'
549
+ puts '+====================+'
550
+
551
+ tree_builder = Psychgus::StyledTreeBuilder.new(styler,**options)
500
552
  visitor = Psych::Visitors::YAMLTree.create(options,tree_builder)
501
553
 
502
554
  visitor << coffee
@@ -505,8 +557,12 @@ visitor << eggs
505
557
  puts visitor.tree.to_yaml
506
558
  puts
507
559
 
508
- # Low-level parsing
509
- parser = Psychgus.parser(options)
560
+ # Low-level parsing.
561
+ puts '+===================+'
562
+ puts '| Low-level parsing |'
563
+ puts '+===================+'
564
+
565
+ parser = Psychgus.parser(**options)
510
566
 
511
567
  parser.parse(coffee_yaml)
512
568
 
@@ -514,63 +570,6 @@ puts parser.handler.root.to_ruby
514
570
  puts
515
571
  ```
516
572
 
517
- ### Common Stylers
518
-
519
- A collection of commonly-used [Stylers](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers.html) and [Stylables](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylables.html) are included with Psychgus.
520
-
521
- | Styler | Description |
522
- | --- | --- |
523
- | [CapStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/CapStyler.html) | Capitalizer for Scalars |
524
- | [FlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/FlowStyler.html) | FLOW style changer for Mappings & Sequences |
525
- | [MapFlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/MapFlowStyler.html) | FLOW style changer for Mappings only |
526
- | [NoSymStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/NoSymStyler.html) | Symbol remover for Scalars |
527
- | [NoTagStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/NoTagStyler.html) | Tag remover for classes |
528
- | [SeqFlowStyler](https://esotericpig.github.io/docs/psychgus/yardoc/Psychgus/Stylers/SeqFlowStyler.html) | FLOW style changer for Sequences only |
529
-
530
- #### Stylers Example
531
-
532
- ```Ruby
533
- require 'psychgus'
534
-
535
- class EggCarton
536
- def initialize
537
- @eggs = {
538
- :styles => ['fried', 'scrambled', ['BBQ', 'ketchup & mustard']],
539
- :colors => ['brown', 'white', ['blue', 'green']]
540
- }
541
- end
542
- end
543
-
544
- puts EggCarton.new.to_yaml(stylers: [
545
- Psychgus::NoSymStyler.new,
546
- Psychgus::NoTagStyler.new,
547
- Psychgus::CapStyler.new,
548
- Psychgus::FlowStyler.new(4)
549
- ])
550
-
551
- # Output:
552
- # ---
553
- # Eggs:
554
- # Styles: [Fried, Scrambled, [BBQ, Ketchup & Mustard]]
555
- # Colors: [Brown, White, [Blue, Green]]
556
-
557
- puts EggCarton.new.to_yaml
558
-
559
- # Output (without Stylers):
560
- # --- !ruby/object:EggCarton
561
- # eggs:
562
- # :styles:
563
- # - fried
564
- # - scrambled
565
- # - - BBQ
566
- # - ketchup & mustard
567
- # :colors:
568
- # - brown
569
- # - white
570
- # - - blue
571
- # - green
572
- ```
573
-
574
573
  ## Hacking
575
574
 
576
575
  ```
@@ -580,20 +579,12 @@ $ bundle install
580
579
  $ bundle exec rake -T
581
580
  ```
582
581
 
583
- ### Testing
584
-
585
582
  Run tests:
586
583
 
587
584
  `$ bundle exec rake test`
588
585
 
589
- ### Generating Doc
590
-
591
586
  Generate doc:
592
587
 
593
- `$ bundle exec rake doc`
594
-
595
- Clean &amp; generate pristine doc:
596
-
597
588
  `$ bundle exec rake clobber doc`
598
589
 
599
590
  ## License
data/Rakefile CHANGED
@@ -4,6 +4,7 @@
4
4
  require 'bundler/gem_tasks'
5
5
 
6
6
  require 'yard'
7
+ require 'yard_ghurt'
7
8
 
8
9
  require 'psychgus/version'
9
10
  require 'rake/clean'
@@ -12,22 +13,38 @@ require 'rake/testtask'
12
13
  task default: %i[test]
13
14
 
14
15
  CLEAN.exclude('.git/','stock/')
15
- CLOBBER.include('doc/')
16
+ CLOBBER.include('.yardoc/','doc/')
16
17
 
17
18
  # Execute "rake clobber doc" for pristine docs.
18
19
  desc 'Generate documentation (YARDoc)'
19
- task doc: %i[yard]
20
+ task doc: %i[yard yard_gfm_fix]
20
21
 
21
22
  # To test using different Gem versions:
22
23
  # GST=1 bundle update && bundle exec rake test
23
24
  Rake::TestTask.new do |task|
24
25
  task.libs = ['lib','test']
25
- task.pattern = File.join('test','**','*_test.rb')
26
+ task.pattern = 'test/**/*_test.rb'
26
27
  # task.options = '--verbose' # Execute "rake test TESTOPT=-v" instead.
27
28
  task.verbose = true
28
29
  task.warning = true
29
30
  end
30
31
 
31
32
  YARD::Rake::YardocTask.new do |task|
32
- task.files = [File.join('lib','**','*.rb')]
33
+ task.files = ['lib/**/*.rb']
34
+ task.options += ['--title',"Psychgus v#{Psychgus::VERSION}"]
35
+ end
36
+
37
+ YardGhurt::GFMFixTask.new do |task|
38
+ task.arg_names = [:dev]
39
+ task.dry_run = false
40
+ task.fix_code_langs = true
41
+ task.md_files = ['index.html']
42
+
43
+ task.before = proc do |t2,_args|
44
+ # Delete this file as it's never used (index.html is an exact copy).
45
+ YardGhurt.rm_exist(File.join(t2.doc_dir,'file.README.html'))
46
+
47
+ t2.css_styles << '<link rel="stylesheet" type="text/css" href="/css/prism.css" />'
48
+ t2.js_scripts << '<script src="/js/prism.js"></script>'
49
+ end
33
50
  end
@@ -24,7 +24,7 @@ module Psychgus
24
24
  # attr_reader :my_hash
25
25
  #
26
26
  # def initialize()
27
- # @my_hash = {:key1=>'val1',:key2=>'val2'}
27
+ # @my_hash = {key1: 'val1',key2: 'val2'}
28
28
  # end
29
29
  #
30
30
  # def psychgus_stylers(sniffer)
@@ -30,10 +30,11 @@ module Psychgus
30
30
  # end
31
31
  #
32
32
  # my_obj = {
33
- # :Foods => {
34
- # :Fruits => %w(Apple Banana Blueberry Pear),
35
- # :Veggies => %w(Bean Carrot Celery Pea)
36
- # }}
33
+ # Foods: {
34
+ # Fruits: %w[Apple Banana Blueberry Pear],
35
+ # Veggies: %w[Bean Carrot Celery Pea],
36
+ # }
37
+ # }
37
38
  #
38
39
  # puts my_obj.to_yaml(indentation: 5,stylers: MyStyler.new)
39
40
  #
@@ -20,21 +20,23 @@ module Psychgus
20
20
  # class EggCarton
21
21
  # def initialize
22
22
  # @eggs = {
23
- # :styles => ['fried', 'scrambled', ['BBQ', 'ketchup & mustard']],
24
- # :colors => ['brown', 'white', ['blue', 'green']]
23
+ # styles: ['fried', 'scrambled', ['BBQ', 'ketchup & mustard']],
24
+ # colors: ['brown', 'white', ['blue', 'green']],
25
25
  # }
26
26
  # end
27
27
  # end
28
28
  #
29
29
  # hierarchy = Psychgus::HierarchyStyler.new(io: $stdout)
30
30
  #
31
- # puts EggCarton.new.to_yaml(stylers: [
32
- # Psychgus::NoSymStyler.new,
33
- # Psychgus::NoTagStyler.new,
34
- # Psychgus::CapStyler.new,
35
- # Psychgus::FlowStyler.new(4),
36
- # hierarchy
37
- # ])
31
+ # puts EggCarton.new.to_yaml(
32
+ # stylers: [
33
+ # Psychgus::NoSymStyler.new,
34
+ # Psychgus::NoTagStyler.new,
35
+ # Psychgus::CapStyler.new,
36
+ # Psychgus::FlowStyler.new(4),
37
+ # hierarchy,
38
+ # ]
39
+ # )
38
40
  #
39
41
  # # Output:
40
42
  # # ---
@@ -78,8 +80,9 @@ module Psychgus
78
80
  # 'BBQ eggs',
79
81
  # 'hard-boiled eggs',
80
82
  # 'soft_boiled eggs',
81
- # 'fried@eggs'
82
- # ]}
83
+ # 'fried@eggs',
84
+ # ]
85
+ # }
83
86
  #
84
87
  # seq_flow = Psychgus::SeqFlowStyler.new
85
88
  #
@@ -205,10 +208,11 @@ module Psychgus
205
208
  # require 'psychgus'
206
209
  #
207
210
  # data = {
208
- # :eggs => {
209
- # :styles => ['Fried', 'Scrambled', ['BBQ', 'Ketchup']],
210
- # :colors => ['Brown', 'White', ['Blue', 'Green']]
211
- # }}
211
+ # eggs: {
212
+ # styles: ['Fried', 'Scrambled', ['BBQ', 'Ketchup']],
213
+ # colors: ['Brown', 'White', ['Blue', 'Green']],
214
+ # }
215
+ # }
212
216
  #
213
217
  # flow = Psychgus::FlowStyler.new(4)
214
218
  #
@@ -10,5 +10,5 @@
10
10
 
11
11
  module Psychgus
12
12
  # Version of this gem in "#.#.#" format.
13
- VERSION = '1.3.6'
13
+ VERSION = '1.3.7'
14
14
  end
data/lib/psychgus.rb CHANGED
@@ -22,7 +22,6 @@ require 'psychgus/version'
22
22
  require 'psychgus/ext/core_ext'
23
23
  require 'psychgus/ext/node_ext'
24
24
  require 'psychgus/ext/yaml_tree_ext'
25
-
26
25
  require 'psychgus/super_sniffer/parent'
27
26
 
28
27
  ###
@@ -31,267 +30,6 @@ require 'psychgus/super_sniffer/parent'
31
30
  # Thank you to the people that worked and continue to work hard on that project.
32
31
  #
33
32
  # The name comes from the well-styled character Gus from the TV show Psych.
34
- #
35
- # == Create a Styler
36
- #
37
- # First, we will create a {Styler}.
38
- #
39
- # All you need to do is add +include Psychgus::Styler+ to a class.
40
- #
41
- # Here is a complex {Styler} for the examples below:
42
- # require 'psychgus'
43
- #
44
- # class BurgerStyler
45
- # # Mix in methods needed for styling
46
- # include Psychgus::Styler
47
- #
48
- # def initialize(sniffer=nil)
49
- # if sniffer.nil?()
50
- # @class_level = 0
51
- # @class_position = 0
52
- # else
53
- # # For the Class Example
54
- # @class_level = sniffer.level
55
- # @class_position = sniffer.position
56
- # end
57
- # end
58
- #
59
- # # Style all nodes (Psych::Nodes::Node)
60
- # def style(sniffer,node)
61
- # # Remove "!ruby/object:..." for classes
62
- # node.tag = nil if node.node_of?(:mapping,:scalar,:sequence)
63
- #
64
- # # This is another way to do the above
65
- # #node.tag = nil if node.respond_to?(:tag=)
66
- # end
67
- #
68
- # # Style aliases (Psych::Nodes::Alias)
69
- # def style_alias(sniffer,node)
70
- # end
71
- #
72
- # # Style maps (Psych::Nodes::Mapping)
73
- # # - Hashes (key/value pairs)
74
- # # - Example: "Burgers: Classic {}"
75
- # def style_mapping(sniffer,node)
76
- # parent = sniffer.parent
77
- #
78
- # if !parent.nil?()
79
- # # BBQ
80
- # node.style = Psychgus::MAPPING_FLOW if parent.node_of?(:scalar) &&
81
- # parent.value.casecmp('BBQ') == 0
82
- # end
83
- # end
84
- #
85
- # # Style scalars (Psych::Nodes::Scalar)
86
- # # - Any text (non-alias)
87
- # def style_scalar(sniffer,node)
88
- # parent = sniffer.parent
89
- #
90
- # # Single quote scalars that are not keys to a map
91
- # # - "child_key?" is the same as "child_type == :key"
92
- # node.style = Psychgus::SCALAR_SINGLE_QUOTED unless parent.child_key?()
93
- #
94
- # # Remove colon (change symbols into strings)
95
- # node.value = node.value.sub(':','')
96
- #
97
- # # Change lettuce to spinach
98
- # node.value = 'Spinach' if node.value.casecmp('Lettuce') == 0
99
- #
100
- # # Capitalize each word
101
- # node.value = node.value.split(' ').map do |v|
102
- # if v.casecmp('BBQ') == 0
103
- # v.upcase()
104
- # else
105
- # v.capitalize()
106
- # end
107
- # end.join(' ')
108
- # end
109
- #
110
- # # Style sequences (Psych::Nodes::Sequence)
111
- # # - Arrays
112
- # # - Example: "[Lettuce, Onions, Pickles, Tomatoes]"
113
- # def style_sequence(sniffer,node)
114
- # relative_level = (sniffer.level - @class_level) + 1
115
- #
116
- # node.style = Psychgus::SEQUENCE_FLOW if sniffer.level >= 4
117
- #
118
- # # Make "[Ketchup, Mustard]" a block for the Class Example
119
- # node.style = Psychgus::SEQUENCE_BLOCK if relative_level == 7
120
- # end
121
- # end
122
- #
123
- # @example Hash example
124
- # require 'psychgus'
125
- #
126
- # burgers = {
127
- # :Burgers => {
128
- # :Classic => {
129
- # :Sauce => %w(Ketchup Mustard),
130
- # :Cheese => 'American',
131
- # :Bun => 'Sesame Seed'
132
- # },
133
- # :BBQ => {
134
- # :Sauce => 'Honey BBQ',
135
- # :Cheese => 'Cheddar',
136
- # :Bun => 'Kaiser'
137
- # },
138
- # :Fancy => {
139
- # :Sauce => 'Spicy Wasabi',
140
- # :Cheese => 'Smoked Gouda',
141
- # :Bun => 'Hawaiian'
142
- # }
143
- # },
144
- # :Toppings => [
145
- # 'Mushrooms',
146
- # %w(Lettuce Onions Pickles Tomatoes),
147
- # [%w(Ketchup Mustard), %w(Salt Pepper)]
148
- # ]
149
- # }
150
- # burgers[:Favorite] = burgers[:Burgers][:BBQ] # Alias
151
- #
152
- # puts burgers.to_yaml(indent: 3,stylers: BurgerStyler.new,deref_aliases: true)
153
- #
154
- # # Output:
155
- # # ---
156
- # # Burgers:
157
- # # Classic:
158
- # # Sauce: ['Ketchup', 'Mustard']
159
- # # Cheese: 'American'
160
- # # Bun: 'Sesame Seed'
161
- # # BBQ: {Sauce: 'Honey BBQ', Cheese: 'Cheddar', Bun: 'Kaiser'}
162
- # # Fancy:
163
- # # Sauce: 'Spicy Wasabi'
164
- # # Cheese: 'Smoked Gouda'
165
- # # Bun: 'Hawaiian'
166
- # # Toppings:
167
- # # - 'Mushrooms'
168
- # # - ['Spinach', 'Onions', 'Pickles', 'Tomatoes']
169
- # # - [['Ketchup', 'Mustard'], ['Salt', 'Pepper']]
170
- # # Favorite:
171
- # # Sauce: 'Honey BBQ'
172
- # # Cheese: 'Cheddar'
173
- # # Bun: 'Kaiser'
174
- #
175
- # @example Class example
176
- # require 'psychgus'
177
- #
178
- # class Burger
179
- # attr_accessor :bun
180
- # attr_accessor :cheese
181
- # attr_accessor :sauce
182
- #
183
- # def initialize(sauce,cheese,bun)
184
- # @bun = bun
185
- # @cheese = cheese
186
- # @sauce = sauce
187
- # end
188
- #
189
- # # You can still use Psych's encode_with(), no problem
190
- # #def encode_with(coder)
191
- # # coder['Bun'] = @bun
192
- # # coder['Cheese'] = @cheese
193
- # # coder['Sauce'] = @sauce
194
- # #end
195
- # end
196
- #
197
- # class Burgers
198
- # include Psychgus::Blueberry
199
- #
200
- # attr_accessor :burgers
201
- # attr_accessor :toppings
202
- # attr_accessor :favorite
203
- #
204
- # def initialize()
205
- # @burgers = {
206
- # 'Classic' => Burger.new(['Ketchup','Mustard'],'American','Sesame Seed'),
207
- # 'BBQ' => Burger.new('Honey BBQ','Cheddar','Kaiser'),
208
- # 'Fancy' => Burger.new('Spicy Wasabi','Smoked Gouda','Hawaiian')
209
- # }
210
- #
211
- # @toppings = [
212
- # 'Mushrooms',
213
- # %w(Lettuce Onions Pickles Tomatoes),
214
- # [%w(Ketchup Mustard),%w(Salt Pepper)]
215
- # ]
216
- #
217
- # @favorite = @burgers['BBQ'] # Alias
218
- # end
219
- #
220
- # def psychgus_stylers(sniffer)
221
- # return BurgerStyler.new(sniffer)
222
- # end
223
- #
224
- # # You can still use Psych's encode_with(), no problem
225
- # #def encode_with(coder)
226
- # # coder['Burgers'] = @burgers
227
- # # coder['Toppings'] = @toppings
228
- # # coder['Favorite'] = @favorite
229
- # #end
230
- # end
231
- #
232
- # burgers = Burgers.new
233
- # puts burgers.to_yaml(indent: 3,deref_aliases: true)
234
- #
235
- # # Output:
236
- # # ---
237
- # # Burgers:
238
- # # Classic:
239
- # # Bun: 'Sesame Seed'
240
- # # Cheese: 'American'
241
- # # Sauce:
242
- # # - 'Ketchup'
243
- # # - 'Mustard'
244
- # # BBQ: {Bun: 'Kaiser', Cheese: 'Cheddar', Sauce: 'Honey BBQ'}
245
- # # Fancy:
246
- # # Bun: 'Hawaiian'
247
- # # Cheese: 'Smoked Gouda'
248
- # # Sauce: 'Spicy Wasabi'
249
- # # Toppings:
250
- # # - 'Mushrooms'
251
- # # - ['Spinach', 'Onions', 'Pickles', 'Tomatoes']
252
- # # - [['Ketchup', 'Mustard'], ['Salt', 'Pepper']]
253
- # # Favorite:
254
- # # Bun: 'Kaiser'
255
- # # Cheese: 'Cheddar'
256
- # # Sauce: 'Honey BBQ'
257
- #
258
- # @example Emitting / Parsing examples
259
- # styler = BurgerStyler.new()
260
- # options = {:indentation=>3,:stylers=>styler,:deref_aliases=>true}
261
- # yaml = burgers.to_yaml(options)
262
- #
263
- # # High-level emitting
264
- # Psychgus.dump(burgers,options)
265
- # Psychgus.dump_file('burgers.yaml',burgers,options)
266
- # burgers.to_yaml(options)
267
- #
268
- # # High-level parsing
269
- # # - Because to_ruby() will be called, just use Psych:
270
- # # - load(), load_file(), load_stream(), safe_load()
271
- #
272
- # # Mid-level emitting
273
- # stream = Psychgus.parse_stream(yaml,stylers: styler,deref_aliases: true)
274
- #
275
- # stream.to_yaml()
276
- #
277
- # # Mid-level parsing
278
- # Psychgus.parse(yaml,stylers: styler,deref_aliases: true)
279
- # Psychgus.parse_file('burgers.yaml',stylers: styler,deref_aliases: true)
280
- # Psychgus.parse_stream(yaml,stylers: styler,deref_aliases: true)
281
- #
282
- # # Low-level emitting
283
- # tree_builder = Psychgus::StyledTreeBuilder.new(styler,deref_aliases: true)
284
- # visitor = Psych::Visitors::YAMLTree.create(options,tree_builder)
285
- #
286
- # visitor << burgers
287
- # visitor.tree.to_yaml
288
- #
289
- # # Low-level parsing
290
- # parser = Psychgus.parser(stylers: styler,deref_aliases: true)
291
- #
292
- # parser.parse(yaml)
293
- # parser.handler
294
- # parser.handler.root
295
33
  ###
296
34
  module Psychgus
297
35
  # Include these in the top namespace for convenience (i.e., less typing).
@@ -443,7 +181,7 @@ module Psychgus
443
181
  # then options will be set to the Hash, instead of objects.
444
182
  #
445
183
  # For example, the below will be stored in options, not objects:
446
- # - dump_stream({:coffee => {:roast => [],:style => []}})
184
+ # - dump_stream({coffee: {roast: [],style: []}})
447
185
  #
448
186
  # This if-statement is guaranteed because dump_stream([]) and dump_stream(nil)
449
187
  # will produce [[]] and [nil], which are not empty.
@@ -474,8 +212,8 @@ module Psychgus
474
212
 
475
213
  if objects.empty?
476
214
  # Else, will throw a cryptic NoMethodError:
477
- # - "psych/tree_builder.rb:in `set_end_location':
478
- # undefined method `end_line=' for nil:NilClass (NoMethodError)"
215
+ # psych/tree_builder.rb:in `set_end_location':
216
+ # undefined method `end_line=' for nil:NilClass (NoMethodError)
479
217
  #
480
218
  # This should never occur because of the if-statement at the top of this method.
481
219
  visitor << nil
@@ -496,21 +234,21 @@ module Psychgus
496
234
  # require 'psychgus'
497
235
  #
498
236
  # burgers = {
499
- # :burgers => {
500
- # :classic => {:sauce => %w(Ketchup Mustard),
501
- # :cheese => 'American',
502
- # :bun => 'Sesame Seed'},
503
- # :bbq => {:sauce => 'Honey BBQ',
504
- # :cheese => 'Cheddar',
505
- # :bun => 'Kaiser'},
506
- # :fancy => {:sauce => 'Spicy Wasabi',
507
- # :cheese => 'Smoked Gouda',
508
- # :bun => 'Hawaiian'}
237
+ # burgers: {
238
+ # classic: {sauce: %w[Ketchup Mustard],
239
+ # cheese: 'American',
240
+ # bun: 'Sesame Seed'},
241
+ # bbq: {sauce: 'Honey BBQ',
242
+ # cheese: 'Cheddar',
243
+ # bun: 'Kaiser'},
244
+ # fancy: {sauce: 'Spicy Wasabi',
245
+ # cheese: 'Smoked Gouda',
246
+ # bun: 'Hawaiian'},
509
247
  # },
510
- # :toppings => [
248
+ # toppings: [
511
249
  # 'Mushrooms',
512
- # %w(Lettuce Onions Pickles Tomatoes),
513
- # [%w(Ketchup Mustard), %w(Salt Pepper)]
250
+ # %w[Lettuce Onions Pickles Tomatoes],
251
+ # [%w[Ketchup Mustard], %w[Salt Pepper]],
514
252
  # ]
515
253
  # }
516
254
  #
@@ -637,17 +375,17 @@ module Psychgus
637
375
  # and the styler(s) will do nothing for you.
638
376
  #
639
377
  # @example
640
- # burgers = <<EOY
641
- # ---
642
- # Burgers:
643
- # Classic:
644
- # BBQ: {Sauce: Honey BBQ, Cheese: Cheddar, Bun: Kaiser}
645
- # ---
646
- # Toppings:
647
- # - [Mushrooms, Mustard]
648
- # - [Salt, Pepper, Pickles]
649
- # ---
650
- # `Invalid`
378
+ # burgers = <<~EOY
379
+ # ---
380
+ # Burgers:
381
+ # Classic:
382
+ # BBQ: {Sauce: Honey BBQ, Cheese: Cheddar, Bun: Kaiser}
383
+ # ---
384
+ # Toppings:
385
+ # - [Mushrooms, Mustard]
386
+ # - [Salt, Pepper, Pickles]
387
+ # ---
388
+ # `Invalid`
651
389
  # EOY
652
390
  #
653
391
  # i = 0
@@ -707,16 +445,16 @@ module Psychgus
707
445
  # end
708
446
  # end
709
447
  #
710
- # coffee = <<EOY
711
- # Coffee:
712
- # Roast:
713
- # - Light
714
- # - Medium
715
- # - Dark
716
- # Style:
717
- # - Cappuccino
718
- # - Latte
719
- # - Mocha
448
+ # coffee = <<~EOY
449
+ # Coffee:
450
+ # Roast:
451
+ # - Light
452
+ # - Medium
453
+ # - Dark
454
+ # Style:
455
+ # - Cappuccino
456
+ # - Latte
457
+ # - Mocha
720
458
  # EOY
721
459
  #
722
460
  # parser = Psychgus.parser(stylers: CoffeeStyler.new)
@@ -752,7 +490,7 @@ module Psychgus
752
490
  #
753
491
  # Private methods of Psych are not defined.
754
492
  #
755
- # @note For devs/hacking: because extend is used, do not prefix methods with "self."
493
+ # @note For devs/hacking: because extend is used, do not prefix methods with `self.`.
756
494
  ###
757
495
  module PsychDropIn
758
496
  # @see Psych.add_builtin_type
data/psychgus.gemspec CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |spec|
27
27
  spec.bindir = 'bin'
28
28
 
29
29
  spec.files = [
30
- Dir.glob(File.join("{#{spec.require_paths.join(',')}}",'**','*.{erb,rb}')),
31
- Dir.glob(File.join(spec.bindir,'*')),
32
- Dir.glob(File.join('{samples,test,yard}','**','*.{erb,rb}')),
30
+ Dir.glob("{#{spec.require_paths.join(',')}}/**/*.{erb,rb}"),
31
+ Dir.glob("#{spec.bindir}/*"),
32
+ Dir.glob('{samples,test,yard}/**/*.{erb,rb}'),
33
33
  %W[Gemfile #{spec.name}.gemspec Rakefile .yardopts],
34
34
  %w[LICENSE.txt CHANGELOG.md README.md],
35
35
  ].flatten
@@ -73,11 +73,11 @@ Toppings:
73
73
 
74
74
  data = Psych.load_file(file)
75
75
  refute_equal false,data
76
- refute_equal nil,data
76
+ refute_nil data
77
77
 
78
78
  data = Psychgus.parse_file(file)
79
79
  refute_equal false,data
80
- refute_equal nil,data
80
+ refute_nil data
81
81
  end
82
82
  end
83
83
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: psychgus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.6
4
+ version: 1.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bradley Whited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-01 00:00:00.000000000 Z
11
+ date: 2025-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: psych