psychgus 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,287 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ #--
5
+ # This file is part of Psychgus.
6
+ # Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
7
+ #
8
+ # Psychgus is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Psychgus is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with Psychgus. If not, see <http://www.gnu.org/licenses/>.
20
+ #++
21
+
22
+
23
+ require 'psychgus_tester'
24
+
25
+ require 'stringio'
26
+
27
+ class IOStyler
28
+ include Psychgus::Styler
29
+
30
+ attr_reader :io
31
+
32
+ def initialize(io=StringIO.new())
33
+ @io = io
34
+ end
35
+
36
+ def style(sniffer,node)
37
+ (1...sniffer.level).each do
38
+ @io.print ' '
39
+ end
40
+
41
+ name = node.node_of?(:scalar) ? node.value : node.class.name
42
+ parent = sniffer.parent
43
+
44
+ @io.print "(#{sniffer.level}:#{sniffer.position}):#{name} - "
45
+ @io.print parent.nil?() ? '<nil>' : parent
46
+ @io.puts
47
+ end
48
+ end
49
+
50
+ class SnifferTest < PsychgusTester
51
+ def setup()
52
+ end
53
+
54
+ def assert_hierarchy(data,expected)
55
+ expected = self.class.lstrip_pipe(expected)
56
+ io_styler = IOStyler.new()
57
+
58
+ data.to_yaml(stylers: io_styler)
59
+ hierarchy = io_styler.io.string
60
+
61
+ assert_equal expected,hierarchy
62
+ end
63
+
64
+ def test_multi_doc()
65
+ expected = <<-EOH
66
+ |(1:1):Psych::Nodes::Stream - <nil>
67
+ |(1:1):Psych::Nodes::Document - <stream:(1:1)::(:1)>
68
+ |(1:1):Psych::Nodes::Mapping - <doc:(1:1)::(:1)>
69
+ | (2:1):Burgers - <map:(1:1):key:(:1)>
70
+ | (3:1):Psych::Nodes::Mapping - <Burgers:(2:1):value:(:1)>
71
+ | (4:1):Classic - <map:(3:1):key:(:1)>
72
+ | (5:1):Psych::Nodes::Mapping - <Classic:(4:1):value:(:1)>
73
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
74
+ | (7:1):Psych::Nodes::Sequence - <Sauce:(6:1):value:(:1)>
75
+ | (8:1):Ketchup - <seq:(7:1)::(:1)>
76
+ | (8:2):Mustard - <seq:(7:1)::(:2)>
77
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
78
+ | (7:1):American - <Cheese:(6:2):value:(:1)>
79
+ | (6:3):Bun - <map:(5:1):key:(:3)>
80
+ | (7:1):Sesame Seed - <Bun:(6:3):value:(:1)>
81
+ | (4:2):BBQ - <map:(3:1):key:(:2)>
82
+ | (5:1):Psych::Nodes::Mapping - <BBQ:(4:2):value:(:1)>
83
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
84
+ | (7:1):Honey BBQ - <Sauce:(6:1):value:(:1)>
85
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
86
+ | (7:1):Cheddar - <Cheese:(6:2):value:(:1)>
87
+ | (6:3):Bun - <map:(5:1):key:(:3)>
88
+ | (7:1):Kaiser - <Bun:(6:3):value:(:1)>
89
+ | (4:3):Fancy - <map:(3:1):key:(:3)>
90
+ | (5:1):Psych::Nodes::Mapping - <Fancy:(4:3):value:(:1)>
91
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
92
+ | (7:1):Spicy Wasabi - <Sauce:(6:1):value:(:1)>
93
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
94
+ | (7:1):Smoked Gouda - <Cheese:(6:2):value:(:1)>
95
+ | (6:3):Bun - <map:(5:1):key:(:3)>
96
+ | (7:1):Hawaiian - <Bun:(6:3):value:(:1)>
97
+ | (2:2):Toppings - <map:(1:1):key:(:2)>
98
+ | (3:1):Psych::Nodes::Sequence - <Toppings:(2:2):value:(:1)>
99
+ | (4:1):Mushrooms - <seq:(3:1)::(:1)>
100
+ | (4:2):Psych::Nodes::Sequence - <seq:(3:1)::(:2)>
101
+ | (5:1):Lettuce - <seq:(4:2)::(:1)>
102
+ | (5:2):Onions - <seq:(4:2)::(:2)>
103
+ | (5:3):Pickles - <seq:(4:2)::(:3)>
104
+ | (5:4):Tomatoes - <seq:(4:2)::(:4)>
105
+ | (4:3):Psych::Nodes::Sequence - <seq:(3:1)::(:3)>
106
+ | (5:1):Psych::Nodes::Sequence - <seq:(4:3)::(:1)>
107
+ | (6:1):Ketchup - <seq:(5:1)::(:1)>
108
+ | (6:2):Mustard - <seq:(5:1)::(:2)>
109
+ | (5:2):Psych::Nodes::Sequence - <seq:(4:3)::(:2)>
110
+ | (6:1):Salt - <seq:(5:2)::(:1)>
111
+ | (6:2):Pepper - <seq:(5:2)::(:2)>
112
+ |(1:2):Psych::Nodes::Document - <stream:(1:1)::(:2)>
113
+ |(1:2):Psych::Nodes::Mapping - <doc:(1:2)::(:1)>
114
+ | (2:1):Courses - <map:(1:2):key:(:1)>
115
+ | (3:1):Psych::Nodes::Mapping - <Courses:(2:1):value:(:1)>
116
+ | (4:1):COSC - <map:(3:1):key:(:1)>
117
+ | (5:1):Psych::Nodes::Sequence - <COSC:(4:1):value:(:1)>
118
+ | (6:1):470 - <seq:(5:1)::(:1)>
119
+ | (6:2):Computer Science - <seq:(5:1)::(:2)>
120
+ | (4:2):MUSC - <map:(3:1):key:(:2)>
121
+ | (5:1):Psych::Nodes::Sequence - <MUSC:(4:2):value:(:1)>
122
+ | (6:1):340 - <seq:(5:1)::(:1)>
123
+ | (6:2):Music - <seq:(5:1)::(:2)>
124
+ | (4:3):ARTS - <map:(3:1):key:(:3)>
125
+ | (5:1):Psych::Nodes::Sequence - <ARTS:(4:3):value:(:1)>
126
+ | (6:1):250 - <seq:(5:1)::(:1)>
127
+ | (6:2):The Arts - <seq:(5:1)::(:2)>
128
+ | (2:2):Schedule - <map:(1:2):key:(:2)>
129
+ | (3:1):Psych::Nodes::Sequence - <Schedule:(2:2):value:(:1)>
130
+ | (4:1):Psych::Nodes::Mapping - <seq:(3:1)::(:1)>
131
+ | (5:1):Course - <map:(4:1):key:(:1)>
132
+ | (6:1):COSC - <Course:(5:1):value:(:1)>
133
+ | (5:2):Time - <map:(4:1):key:(:2)>
134
+ | (6:1):08:00 - <Time:(5:2):value:(:1)>
135
+ | (4:2):Psych::Nodes::Mapping - <seq:(3:1)::(:2)>
136
+ | (5:1):Course - <map:(4:2):key:(:1)>
137
+ | (6:1):MUSC - <Course:(5:1):value:(:1)>
138
+ | (5:2):Time - <map:(4:2):key:(:2)>
139
+ | (6:1):10:30 - <Time:(5:2):value:(:1)>
140
+ | (4:3):Psych::Nodes::Mapping - <seq:(3:1)::(:3)>
141
+ | (5:1):Course - <map:(4:3):key:(:1)>
142
+ | (6:1):ARTS - <Course:(5:1):value:(:1)>
143
+ | (5:2):Time - <map:(4:3):key:(:2)>
144
+ | (6:1):15:10 - <Time:(5:2):value:(:1)>
145
+ | (4:4):Psych::Nodes::Mapping - <seq:(3:1)::(:4)>
146
+ | (5:1):Course - <map:(4:4):key:(:1)>
147
+ | (6:1):COSC - <Course:(5:1):value:(:1)>
148
+ | (5:2):Time - <map:(4:4):key:(:2)>
149
+ | (6:1):13:10 - <Time:(5:2):value:(:1)>
150
+ |(1:3):Psych::Nodes::Document - <stream:(1:1)::(:3)>
151
+ |(1:3):Psych::Nodes::Mapping - <doc:(1:3)::(:1)>
152
+ | (2:1):Dolphins - <map:(1:3):key:(:1)>
153
+ | (3:1):Psych::Nodes::Mapping - <Dolphins:(2:1):value:(:1)>
154
+ | (4:1):Common - <map:(3:1):key:(:1)>
155
+ | (5:1):Psych::Nodes::Mapping - <Common:(4:1):value:(:1)>
156
+ | (6:1):Length - <map:(5:1):key:(:1)>
157
+ | (7:1):~2.5m - <Length:(6:1):value:(:1)>
158
+ | (6:2):Weight - <map:(5:1):key:(:2)>
159
+ | (7:1):~235kg - <Weight:(6:2):value:(:1)>
160
+ | (4:2):Bottlenose - <map:(3:1):key:(:2)>
161
+ | (5:1):Psych::Nodes::Mapping - <Bottlenose:(4:2):value:(:1)>
162
+ | (6:1):Length - <map:(5:1):key:(:1)>
163
+ | (7:1):~4m - <Length:(6:1):value:(:1)>
164
+ | (6:2):Weight - <map:(5:1):key:(:2)>
165
+ | (7:1):~300kg - <Weight:(6:2):value:(:1)>
166
+ | (4:3):Dusky - <map:(3:1):key:(:3)>
167
+ | (5:1):Psych::Nodes::Mapping - <Dusky:(4:3):value:(:1)>
168
+ | (6:1):Length - <map:(5:1):key:(:1)>
169
+ | (7:1):~1.7m - <Length:(6:1):value:(:1)>
170
+ | (6:2):Weight - <map:(5:1):key:(:2)>
171
+ | (7:1):~78kg - <Weight:(6:2):value:(:1)>
172
+ | (4:4):Orca - <map:(3:1):key:(:4)>
173
+ | (5:1):Psych::Nodes::Mapping - <Orca:(4:4):value:(:1)>
174
+ | (6:1):Length - <map:(5:1):key:(:1)>
175
+ | (7:1):~7m - <Length:(6:1):value:(:1)>
176
+ | (6:2):Weight - <map:(5:1):key:(:2)>
177
+ | (7:1):~3600kg - <Weight:(6:2):value:(:1)>
178
+ | (2:2):Popular - <map:(1:3):key:(:2)>
179
+ | (3:1):Psych::Nodes::Sequence - <Popular:(2:2):value:(:1)>
180
+ | (4:1):Psych::Nodes::Alias - <seq:(3:1)::(:1)>
181
+ | (4:2):Psych::Nodes::Alias - <seq:(3:1)::(:2)>
182
+ EOH
183
+
184
+ expected = self.class.lstrip_pipe(expected)
185
+ io_styler = IOStyler.new()
186
+
187
+ Psychgus.dump_stream(BURGERS_DATA,COURSES_DATA,DOLPHINS_DATA,stylers: io_styler)
188
+ hierarchy = io_styler.io.string
189
+
190
+ assert_equal expected,hierarchy
191
+ end
192
+
193
+ def test_single_docs()
194
+ assert_hierarchy(BURGERS_DATA,<<-EOH
195
+ |(1:1):Psych::Nodes::Stream - <nil>
196
+ |(1:1):Psych::Nodes::Document - <stream:(1:1)::(:1)>
197
+ |(1:1):Psych::Nodes::Mapping - <doc:(1:1)::(:1)>
198
+ | (2:1):Burgers - <map:(1:1):key:(:1)>
199
+ | (3:1):Psych::Nodes::Mapping - <Burgers:(2:1):value:(:1)>
200
+ | (4:1):Classic - <map:(3:1):key:(:1)>
201
+ | (5:1):Psych::Nodes::Mapping - <Classic:(4:1):value:(:1)>
202
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
203
+ | (7:1):Psych::Nodes::Sequence - <Sauce:(6:1):value:(:1)>
204
+ | (8:1):Ketchup - <seq:(7:1)::(:1)>
205
+ | (8:2):Mustard - <seq:(7:1)::(:2)>
206
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
207
+ | (7:1):American - <Cheese:(6:2):value:(:1)>
208
+ | (6:3):Bun - <map:(5:1):key:(:3)>
209
+ | (7:1):Sesame Seed - <Bun:(6:3):value:(:1)>
210
+ | (4:2):BBQ - <map:(3:1):key:(:2)>
211
+ | (5:1):Psych::Nodes::Mapping - <BBQ:(4:2):value:(:1)>
212
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
213
+ | (7:1):Honey BBQ - <Sauce:(6:1):value:(:1)>
214
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
215
+ | (7:1):Cheddar - <Cheese:(6:2):value:(:1)>
216
+ | (6:3):Bun - <map:(5:1):key:(:3)>
217
+ | (7:1):Kaiser - <Bun:(6:3):value:(:1)>
218
+ | (4:3):Fancy - <map:(3:1):key:(:3)>
219
+ | (5:1):Psych::Nodes::Mapping - <Fancy:(4:3):value:(:1)>
220
+ | (6:1):Sauce - <map:(5:1):key:(:1)>
221
+ | (7:1):Spicy Wasabi - <Sauce:(6:1):value:(:1)>
222
+ | (6:2):Cheese - <map:(5:1):key:(:2)>
223
+ | (7:1):Smoked Gouda - <Cheese:(6:2):value:(:1)>
224
+ | (6:3):Bun - <map:(5:1):key:(:3)>
225
+ | (7:1):Hawaiian - <Bun:(6:3):value:(:1)>
226
+ | (2:2):Toppings - <map:(1:1):key:(:2)>
227
+ | (3:1):Psych::Nodes::Sequence - <Toppings:(2:2):value:(:1)>
228
+ | (4:1):Mushrooms - <seq:(3:1)::(:1)>
229
+ | (4:2):Psych::Nodes::Sequence - <seq:(3:1)::(:2)>
230
+ | (5:1):Lettuce - <seq:(4:2)::(:1)>
231
+ | (5:2):Onions - <seq:(4:2)::(:2)>
232
+ | (5:3):Pickles - <seq:(4:2)::(:3)>
233
+ | (5:4):Tomatoes - <seq:(4:2)::(:4)>
234
+ | (4:3):Psych::Nodes::Sequence - <seq:(3:1)::(:3)>
235
+ | (5:1):Psych::Nodes::Sequence - <seq:(4:3)::(:1)>
236
+ | (6:1):Ketchup - <seq:(5:1)::(:1)>
237
+ | (6:2):Mustard - <seq:(5:1)::(:2)>
238
+ | (5:2):Psych::Nodes::Sequence - <seq:(4:3)::(:2)>
239
+ | (6:1):Salt - <seq:(5:2)::(:1)>
240
+ | (6:2):Pepper - <seq:(5:2)::(:2)>
241
+ EOH
242
+ )
243
+
244
+ assert_hierarchy(COURSES_DATA,<<-EOH
245
+ |(1:1):Psych::Nodes::Stream - <nil>
246
+ |(1:1):Psych::Nodes::Document - <stream:(1:1)::(:1)>
247
+ |(1:1):Psych::Nodes::Mapping - <doc:(1:1)::(:1)>
248
+ | (2:1):Courses - <map:(1:1):key:(:1)>
249
+ | (3:1):Psych::Nodes::Mapping - <Courses:(2:1):value:(:1)>
250
+ | (4:1):COSC - <map:(3:1):key:(:1)>
251
+ | (5:1):Psych::Nodes::Sequence - <COSC:(4:1):value:(:1)>
252
+ | (6:1):470 - <seq:(5:1)::(:1)>
253
+ | (6:2):Computer Science - <seq:(5:1)::(:2)>
254
+ | (4:2):MUSC - <map:(3:1):key:(:2)>
255
+ | (5:1):Psych::Nodes::Sequence - <MUSC:(4:2):value:(:1)>
256
+ | (6:1):340 - <seq:(5:1)::(:1)>
257
+ | (6:2):Music - <seq:(5:1)::(:2)>
258
+ | (4:3):ARTS - <map:(3:1):key:(:3)>
259
+ | (5:1):Psych::Nodes::Sequence - <ARTS:(4:3):value:(:1)>
260
+ | (6:1):250 - <seq:(5:1)::(:1)>
261
+ | (6:2):The Arts - <seq:(5:1)::(:2)>
262
+ | (2:2):Schedule - <map:(1:1):key:(:2)>
263
+ | (3:1):Psych::Nodes::Sequence - <Schedule:(2:2):value:(:1)>
264
+ | (4:1):Psych::Nodes::Mapping - <seq:(3:1)::(:1)>
265
+ | (5:1):Course - <map:(4:1):key:(:1)>
266
+ | (6:1):COSC - <Course:(5:1):value:(:1)>
267
+ | (5:2):Time - <map:(4:1):key:(:2)>
268
+ | (6:1):08:00 - <Time:(5:2):value:(:1)>
269
+ | (4:2):Psych::Nodes::Mapping - <seq:(3:1)::(:2)>
270
+ | (5:1):Course - <map:(4:2):key:(:1)>
271
+ | (6:1):MUSC - <Course:(5:1):value:(:1)>
272
+ | (5:2):Time - <map:(4:2):key:(:2)>
273
+ | (6:1):10:30 - <Time:(5:2):value:(:1)>
274
+ | (4:3):Psych::Nodes::Mapping - <seq:(3:1)::(:3)>
275
+ | (5:1):Course - <map:(4:3):key:(:1)>
276
+ | (6:1):ARTS - <Course:(5:1):value:(:1)>
277
+ | (5:2):Time - <map:(4:3):key:(:2)>
278
+ | (6:1):15:10 - <Time:(5:2):value:(:1)>
279
+ | (4:4):Psych::Nodes::Mapping - <seq:(3:1)::(:4)>
280
+ | (5:1):Course - <map:(4:4):key:(:1)>
281
+ | (6:1):COSC - <Course:(5:1):value:(:1)>
282
+ | (5:2):Time - <map:(4:4):key:(:2)>
283
+ | (6:1):13:10 - <Time:(5:2):value:(:1)>
284
+ EOH
285
+ )
286
+ end
287
+ end
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ #--
5
+ # This file is part of Psychgus.
6
+ # Copyright (c) 2019 Jonathan Bradley Whited (@esotericpig)
7
+ #
8
+ # Psychgus is free software: you can redistribute it and/or modify
9
+ # it under the terms of the GNU Lesser General Public License as published by
10
+ # the Free Software Foundation, either version 3 of the License, or
11
+ # (at your option) any later version.
12
+ #
13
+ # Psychgus is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ # GNU Lesser General Public License for more details.
17
+ #
18
+ # You should have received a copy of the GNU Lesser General Public License
19
+ # along with Psychgus. If not, see <http://www.gnu.org/licenses/>.
20
+ #++
21
+
22
+
23
+ require 'psychgus_tester'
24
+
25
+ class MyStyler
26
+ include Psychgus::Styler
27
+
28
+ def style(sniffer,node)
29
+ end
30
+
31
+ def style_alias(sniffer,node)
32
+ end
33
+
34
+ def style_mapping(sniffer,node)
35
+ parent = sniffer.parent
36
+
37
+ if !parent.nil?()
38
+ # BBQ
39
+ node.style = Psychgus::MAPPING_FLOW if parent.node_of?(:scalar) && parent.value.casecmp('BBQ') == 0
40
+
41
+ # Fancy
42
+ node.style = Psychgus::MAPPING_FLOW if parent.level == 4 && parent.position == 3
43
+ end
44
+ end
45
+
46
+ def style_scalar(sniffer,node)
47
+ node.style = Psychgus::SCALAR_SINGLE_QUOTED if node.value.casecmp('Mushrooms') == 0
48
+ node.value = 'Spinach' if node.value.casecmp('Lettuce') == 0
49
+ end
50
+
51
+ def style_sequence(sniffer,node)
52
+ node.style = Psychgus::SEQUENCE_FLOW if sniffer.level >= 3
53
+
54
+ # Burgers=>Classic=>Sauce and Mushrooms
55
+ node.style = Psychgus::SEQUENCE_BLOCK if sniffer.position == 1
56
+ end
57
+ end
58
+
59
+ class StylerTest < PsychgusTester
60
+ def setup()
61
+ @styler = MyStyler.new()
62
+ end
63
+
64
+ def test_styler()
65
+ expected = <<-EOY
66
+ |---
67
+ |Burgers:
68
+ | Classic:
69
+ | Sauce:
70
+ | - Ketchup
71
+ | - Mustard
72
+ | Cheese: American
73
+ | Bun: Sesame Seed
74
+ | BBQ: {Sauce: Honey BBQ, Cheese: Cheddar, Bun: Kaiser}
75
+ | Fancy: {Sauce: Spicy Wasabi, Cheese: Smoked Gouda, Bun: Hawaiian}
76
+ |Toppings:
77
+ |- 'Mushrooms'
78
+ |- [Spinach, Onions, Pickles, Tomatoes]
79
+ |- [[Ketchup, Mustard], [Salt, Pepper]]
80
+ EOY
81
+ expected = self.class.lstrip_pipe(expected)
82
+
83
+ assert_equal expected,BURGERS_DATA.to_yaml(stylers: @styler)
84
+ end
85
+ end
@@ -0,0 +1,5 @@
1
+ <%# To reduce number of diffs, removed time, YARD version, and Ruby version. %>
2
+ <div id="footer">
3
+ Generated by
4
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>.
5
+ </div>
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: psychgus
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jonathan Bradley Whited (@esotericpig)
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-07-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: psych
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 2.0.5
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 2.0.5
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '5.11'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '5.11'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '6.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '6.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: redcarpet
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.4'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: yard
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.9'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.9'
111
+ description: "Easily style YAML files using Psych, like Sequence/Mapping Flow style.\n\nSimple
112
+ example:\n class CoffeeStyler\n include Psychgus::Styler\n \n def style_sequence(sniffer,node)\n
113
+ \ node.style = Psychgus::SEQUENCE_FLOW\n end\n end\n \n coffee = {\n 'Roast'=>['Light',
114
+ 'Medium', 'Dark', 'Extra Dark'],\n 'Style'=>['Cappuccino', 'Espresso', 'Latte',
115
+ 'Mocha']}\n \n puts coffee.to_yaml(stylers: CoffeeStyler.new)\n \n # Output:\n
116
+ \ # ---\n # Roast: [Light, Medium, Dark, Extra Dark]\n # Style: [Cappuccino, Espresso,
117
+ Latte, Mocha]\n\nClass example:\n class Coffee\n include Psychgus::Blueberry\n
118
+ \ \n def initialize\n @roast = ['Light', 'Medium', 'Dark', 'Extra Dark']\n
119
+ \ @style = ['Cappuccino', 'Espresso', 'Latte', 'Mocha']\n end\n \n def
120
+ psychgus_stylers(sniffer)\n CoffeeStyler.new\n end\n end\n \n puts Coffee.new.to_yaml\n
121
+ \ \n # Output:\n # --- !ruby/object:Coffee\n # roast: [Light, Medium, Dark, Extra
122
+ Dark]\n # style: [Cappuccino, Espresso, Latte, Mocha]\n\nThe produced YAML without
123
+ Psychgus styling (i.e., without CoffeeStyler):\n # ---\n # Roast:\n # - Light\n
124
+ \ # - Medium\n # - Dark\n # - Extra Dark\n # Style:\n # - Cappuccino\n # -
125
+ Espresso\n # - Latte\n # - Mocha\n"
126
+ email:
127
+ - bradley@esotericpig.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - Gemfile
133
+ - LICENSE.txt
134
+ - README.md
135
+ - Rakefile
136
+ - lib/psychgus.rb
137
+ - lib/psychgus/blueberry.rb
138
+ - lib/psychgus/ext.rb
139
+ - lib/psychgus/ext/core_ext.rb
140
+ - lib/psychgus/ext/node_ext.rb
141
+ - lib/psychgus/ext/yaml_tree_ext.rb
142
+ - lib/psychgus/styled_document_stream.rb
143
+ - lib/psychgus/styled_tree_builder.rb
144
+ - lib/psychgus/styler.rb
145
+ - lib/psychgus/super_sniffer.rb
146
+ - lib/psychgus/super_sniffer/parent.rb
147
+ - lib/psychgus/version.rb
148
+ - psychgus.gemspec
149
+ - test/blueberry_test.rb
150
+ - test/psychgus_test.rb
151
+ - test/psychgus_tester.rb
152
+ - test/sniffer_test.rb
153
+ - test/styler_test.rb
154
+ - yard/templates/default/layout/html/footer.erb
155
+ homepage: https://github.com/esotericpig/psychgus
156
+ licenses:
157
+ - LGPL-3.0-or-later
158
+ metadata:
159
+ bug_tracker_uri: https://github.com/esotericpig/psychgus/issues
160
+ documentation_uri: https://esotericpig.github.io/docs/psychgus/yardoc/index.html
161
+ homepage_uri: https://github.com/esotericpig/psychgus
162
+ source_code_uri: https://github.com/esotericpig/psychgus
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: 2.1.10
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubygems_version: 3.0.4
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: Easily style YAML files using Psych, like Sequence/Mapping Flow style.
182
+ test_files: []