psychgus 1.3.5 → 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.
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/psychgus.svg)](https://badge.fury.io/rb/psychgus)
4
4
  [![CI Status](https://github.com/esotericpig/psychgus/actions/workflows/ci.yml/badge.svg)](https://github.com/esotericpig/psychgus/actions/workflows/ci.yml)
5
- [![Doc Coverage](http://inch-ci.org/github/esotericpig/psychgus.svg?branch=master)](https://inch-ci.org/github/esotericpig/psychgus)
5
+ [![Doc Coverage](http://inch-ci.org/github/esotericpig/psychgus.svg?branch=main)](https://inch-ci.org/github/esotericpig/psychgus)
6
6
 
7
7
  [![Documentation](https://img.shields.io/badge/doc-yard-%23A0522D.svg)](https://esotericpig.github.io/docs/psychgus/yardoc/index.html)
8
8
  [![Source Code](https://img.shields.io/badge/source-github-%23211F1F.svg)](https://github.com/esotericpig/psychgus)
@@ -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,18 +44,15 @@ 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
- ## [//](#contents) Setup
55
+ ## Setup
63
56
 
64
57
  Pick your poison...
65
58
 
@@ -67,33 +60,30 @@ 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
94
84
  ```
95
85
 
96
- ## [//](#contents) Using
86
+ ## Using
97
87
 
98
88
  Documentation (YARDoc) is available on my [GitHub Page](https://esotericpig.github.io/docs/psychgus/yardoc/index.html) and on [RubyDoc.info](https://www.rubydoc.info/gems/psychgus).
99
89
 
@@ -103,15 +93,72 @@ 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)
113
101
 
114
- ### [//](#using) Simple Example
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
+ ```
160
+
161
+ ### Simple Example
115
162
 
116
163
  ```Ruby
117
164
  require 'psychgus'
@@ -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)
@@ -157,7 +204,7 @@ puts Coffee.new.to_yaml
157
204
  # style: [Cappuccino, Espresso, Latte, Mocha]
158
205
  ```
159
206
 
160
- ### [//](#using) Hash Example
207
+ ### Hash Example
161
208
 
162
209
  ```Ruby
163
210
  require 'psychgus'
@@ -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
  # ---
@@ -252,64 +294,59 @@ puts burgers.to_yaml({:indent => 3,:stylers => BurgerStyler.new,:deref_aliases =
252
294
  # Bun: Kaiser
253
295
  ```
254
296
 
255
- ### [//](#using) Class Example
297
+ ### Class Example
256
298
 
257
299
  ```Ruby
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
@@ -423,7 +460,7 @@ puts burgers.to_yaml({:indent => 3,:deref_aliases => true})
423
460
  # Sauce: 'Honey BBQ'
424
461
  ```
425
462
 
426
- ### [//](#using) Advanced Usage
463
+ ### Advanced Usage
427
464
 
428
465
  ```Ruby
429
466
  require 'psychgus'
@@ -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,64 +570,7 @@ puts parser.handler.root.to_ruby
514
570
  puts
515
571
  ```
516
572
 
517
- ### [//](#using) 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
- #### [//](#common-stylers) 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
- ## [//](#contents) Hacking
573
+ ## Hacking
575
574
 
576
575
  ```
577
576
  $ git clone 'https://github.com/esotericpig/psychgus.git'
@@ -580,28 +579,20 @@ $ bundle install
580
579
  $ bundle exec rake -T
581
580
  ```
582
581
 
583
- ### [//](#hacking) Testing
584
-
585
582
  Run tests:
586
583
 
587
584
  `$ bundle exec rake test`
588
585
 
589
- ### [//](#hacking) 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
- ## [//](#contents) License
590
+ ## License
600
591
 
601
592
  [GNU LGPL v3+](LICENSE.txt)
602
593
 
603
594
  > Psychgus (<https://github.com/esotericpig/psychgus>)
604
- > Copyright (c) 2017-2024 Bradley Whited
595
+ > Copyright (c) 2017-2025 Bradley Whited
605
596
  >
606
597
  > Psychgus is free software: you can redistribute it and/or modify
607
598
  > it under the terms of the GNU Lesser General Public License as published by
data/Rakefile CHANGED
@@ -7,14 +7,13 @@ require 'yard'
7
7
  require 'yard_ghurt'
8
8
 
9
9
  require 'psychgus/version'
10
-
11
10
  require 'rake/clean'
12
11
  require 'rake/testtask'
13
12
 
14
- task default: [:test]
13
+ task default: %i[test]
15
14
 
16
15
  CLEAN.exclude('.git/','stock/')
17
- CLOBBER.include('doc/')
16
+ CLOBBER.include('.yardoc/','doc/')
18
17
 
19
18
  # Execute "rake clobber doc" for pristine docs.
20
19
  desc 'Generate documentation (YARDoc)'
@@ -24,30 +23,28 @@ task doc: %i[yard yard_gfm_fix]
24
23
  # GST=1 bundle update && bundle exec rake test
25
24
  Rake::TestTask.new do |task|
26
25
  task.libs = ['lib','test']
27
- task.pattern = File.join('test','**','*_test.rb')
28
- task.description += " ('#{task.pattern}')"
29
- #task.options = '--verbose' # Execute "rake test TESTOPT=-v" instead.
26
+ task.pattern = 'test/**/*_test.rb'
27
+ # task.options = '--verbose' # Execute "rake test TESTOPT=-v" instead.
30
28
  task.verbose = true
31
29
  task.warning = true
32
30
  end
33
31
 
34
32
  YARD::Rake::YardocTask.new do |task|
35
- task.files = [File.join('lib','**','*.rb')]
33
+ task.files = ['lib/**/*.rb']
34
+ task.options += ['--title',"Psychgus v#{Psychgus::VERSION}"]
36
35
  end
37
36
 
38
37
  YardGhurt::GFMFixTask.new do |task|
39
- task.description = 'Fix (find & replace) text in the YARD files for GitHub differences'
40
-
41
38
  task.arg_names = [:dev]
42
39
  task.dry_run = false
43
40
  task.fix_code_langs = true
44
41
  task.md_files = ['index.html']
45
42
 
46
- task.before = proc do |t2,args|
47
- # Delete this file as it's never used (index.html is an exact copy)
43
+ task.before = proc do |t2,_args|
44
+ # Delete this file as it's never used (index.html is an exact copy).
48
45
  YardGhurt.rm_exist(File.join(t2.doc_dir,'file.README.html'))
49
46
 
50
47
  t2.css_styles << '<link rel="stylesheet" type="text/css" href="/css/prism.css" />'
51
- t2.js_scripts << '<script src="/js/prism.js"></script>)'
48
+ t2.js_scripts << '<script src="/js/prism.js"></script>'
52
49
  end
53
50
  end