psychgus 1.2.0 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,22 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  #--
5
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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
20
9
  #++
21
10
 
22
11
 
@@ -29,27 +18,27 @@ module Psychgus
29
18
  ###
30
19
  # A collection of commonly-used {Styler} mixins
31
20
  # that can be included in a class instead of {Styler}.
32
- #
33
- # @author Jonathan Bradley Whited (@esotericpig)
21
+ #
22
+ # @author Jonathan Bradley Whited
34
23
  # @since 1.2.0
35
- #
24
+ #
36
25
  # @see Stylers
37
26
  # @see Styler
38
27
  ###
39
28
  module Stylables
40
29
  ###
41
30
  # A helper mixin for Stylables that change a node's style.
42
- #
31
+ #
43
32
  # There is no max level, because a parent's style will override all of its children.
44
33
  ###
45
34
  module StyleStylable
46
35
  include Styler
47
-
36
+
48
37
  attr_accessor :min_level # @return [Integer] the minimum level (inclusive) to style
49
38
  attr_accessor :new_style # @return [Integer] the new style to set the nodes to
50
-
39
+
51
40
  # +max_level+ is not defined because a parent's style will override all of its children.
52
- #
41
+ #
53
42
  # @param min_level [Integer] the minimum level (inclusive) to style
54
43
  # @param new_style [Integer] the new style to set the nodes to
55
44
  # @param kargs [Hash] capture extra keyword args, so no error for undefined args
@@ -57,212 +46,212 @@ module Psychgus
57
46
  @min_level = min_level
58
47
  @new_style = new_style
59
48
  end
60
-
49
+
61
50
  # Change the style of +node+ to {new_style} if it is >= {min_level}.
62
51
  def change_style(sniffer,node)
63
52
  return unless node.respond_to?(:style=)
64
-
53
+
65
54
  node.style = @new_style if sniffer.level >= @min_level
66
55
  end
67
56
  end
68
57
  end
69
-
58
+
70
59
  module Stylables
71
60
  ###
72
61
  # (see Stylers::CapStyler)
73
62
  ###
74
63
  module CapStylable
75
64
  include Styler
76
-
65
+
77
66
  attr_reader :delim # @return [String,Regexp] the delimiter to split on
78
67
  attr_accessor :each_word # @return [true,false] whether to capitalize each word separated by {delim}
79
68
  attr_accessor :new_delim # @return [nil,String] the replacement for each {delim} if not nil
80
-
69
+
81
70
  # @param each_word [true,false] whether to capitalize each word separated by +delim+
82
71
  # @param new_delim [nil,String] the replacement for each +delim+ if not nil
83
72
  # @param delim [String,Regexp] the delimiter to split on
84
73
  # @param kargs [Hash] capture extra keyword args, so no error for undefined args
85
74
  def initialize(each_word: true,new_delim: nil,delim: /[\s_\-]/,**kargs)
86
- delim = Regexp.quote(delim.to_s()) unless delim.is_a?(Regexp)
87
-
88
- @delim = Regexp.new("(#{delim.to_s()})")
75
+ delim = Regexp.quote(delim.to_s) unless delim.is_a?(Regexp)
76
+
77
+ @delim = Regexp.new("(#{delim})")
89
78
  @each_word = each_word
90
79
  @new_delim = new_delim
91
80
  end
92
-
81
+
93
82
  # Capitalize an individual word (not words).
94
- #
83
+ #
95
84
  # This method can safely be overridden with a new implementation.
96
- #
85
+ #
97
86
  # @param word [nil,String] the word to capitalize
98
- #
87
+ #
99
88
  # @return [String] the capitalized word
100
89
  def cap_word(word)
101
- return word if word.nil?() || word.empty?()
102
-
90
+ return word if word.nil? || word.empty?
91
+
103
92
  # Already capitalized, good for all-capitalized words, like 'BBQ'
104
- return word if word[0] == word[0].upcase()
105
-
106
- return word.capitalize()
93
+ return word if word[0] == word[0].upcase
94
+
95
+ return word.capitalize
107
96
  end
108
-
97
+
109
98
  # Capitalize +node.value+.
110
- #
99
+ #
111
100
  # @see cap_word
112
101
  # @see Styler#style_scalar
113
102
  def style_scalar(sniffer,node)
114
- if !@each_word || node.value.nil?() || node.value.empty?()
103
+ if !@each_word || node.value.nil? || node.value.empty?
115
104
  node.value = cap_word(node.value)
116
105
  return
117
106
  end
118
-
107
+
119
108
  is_delim = false
120
-
121
- node.value = node.value.split(@delim).map() do |v|
109
+
110
+ node.value = node.value.split(@delim).map do |v|
122
111
  if is_delim
123
- v = @new_delim unless @new_delim.nil?()
112
+ v = @new_delim unless @new_delim.nil?
124
113
  else
125
114
  v = cap_word(v)
126
115
  end
127
-
116
+
128
117
  is_delim = !is_delim
129
118
  v
130
- end.join()
119
+ end.join
131
120
  end
132
121
  end
133
-
122
+
134
123
  ###
135
124
  # (see Stylers::HierarchyStyler)
136
125
  ###
137
126
  module HierarchyStylable
138
127
  include Styler
139
-
128
+
140
129
  attr_accessor :io # @return [IO] the IO to write to; defaults to StringIO
141
130
  attr_accessor :verbose # @return [true,false] whether to be more verbose (e.g., write child info)
142
-
131
+
143
132
  # @param io [IO] the IO to write to
144
133
  # @param verbose [true,false] whether to be more verbose (e.g., write child info)
145
134
  # @param kargs [Hash] capture extra keyword args, so no error for undefined args
146
- def initialize(io: StringIO.new(),verbose: false,**kargs)
135
+ def initialize(io: StringIO.new,verbose: false,**kargs)
147
136
  @io = io
148
137
  @verbose = verbose
149
138
  end
150
-
139
+
151
140
  # Write the hierarchy of +node+ to {io}.
152
- #
141
+ #
153
142
  # @see Styler#style
154
143
  def style(sniffer,node)
155
- @io.print (' ' * (sniffer.level - 1))
156
-
144
+ @io.print(' ' * (sniffer.level - 1))
145
+
157
146
  name = node.respond_to?(:value) ? node.value : node.class.name
158
147
  parent = sniffer.parent
159
-
148
+
160
149
  @io.print "(#{sniffer.level}:#{sniffer.position}):#{name} - "
161
-
150
+
162
151
  if @verbose
163
152
  @io.print parent
164
153
  else
165
154
  @io.print "<#{parent.debug_tag}:(#{parent.level}:#{parent.position})>"
166
155
  end
167
-
156
+
168
157
  @io.puts
169
158
  end
170
-
159
+
171
160
  # Convert {io} to a String if possible (e.g., StringIO).
172
- #
161
+ #
173
162
  # @return [String] the IO String result or just {io} as a String
174
- def to_s()
175
- return @io.respond_to?(:string) ? @io.string : @io.to_s()
163
+ def to_s
164
+ return @io.respond_to?(:string) ? @io.string : @io.to_s
176
165
  end
177
166
  end
178
-
167
+
179
168
  ###
180
169
  # (see Stylers::MapFlowStyler)
181
170
  ###
182
171
  module MapFlowStylable
183
172
  include StyleStylable
184
-
173
+
185
174
  # (see StyleStylable#initialize)
186
175
  # @!method initialize(min_level=0,new_style: nil,**kargs)
187
- #
176
+ #
188
177
  # If +new_style+ is nil (the default), then {MAPPING_FLOW} will be used.
189
178
  def initialize(*)
190
179
  super
191
-
192
- @new_style = MAPPING_FLOW if @new_style.nil?()
180
+
181
+ @new_style = MAPPING_FLOW if @new_style.nil?
193
182
  end
194
-
183
+
195
184
  # Change the style of a Mapping to FLOW (or to the value of {new_style})
196
185
  # if it is >= {min_level}.
197
- #
186
+ #
198
187
  # @see change_style
199
188
  # @see Styler#style_mapping
200
189
  def style_mapping(sniffer,node)
201
190
  change_style(sniffer,node)
202
191
  end
203
192
  end
204
-
193
+
205
194
  ###
206
195
  # (see Stylers::NoSymStyler)
207
196
  ###
208
197
  module NoSymStylable
209
198
  include Styler
210
-
199
+
211
200
  attr_accessor :cap # @return [true,false] whether to capitalize the symbol
212
-
201
+
213
202
  alias_method :cap?,:cap
214
-
203
+
215
204
  # @param cap [true,false] whether to capitalize the symbol
216
205
  # @param kargs [Hash] capture extra keyword args, so no error for undefined args
217
206
  def initialize(cap: true,**kargs)
218
207
  @cap = cap
219
208
  end
220
-
209
+
221
210
  # If +node.value+ is a symbol, change it into a string and capitalize it.
222
- #
211
+ #
223
212
  # @see Styler#style_scalar
224
213
  def style_scalar(sniffer,node)
225
- return if node.value.nil?() || node.value.empty?()
214
+ return if node.value.nil? || node.value.empty?
226
215
  return if node.value[0] != ':'
227
-
216
+
228
217
  node.value = node.value[1..-1]
229
- node.value = node.value.capitalize() if @cap
218
+ node.value = node.value.capitalize if @cap
230
219
  end
231
220
  end
232
-
221
+
233
222
  ###
234
223
  # (see Stylers::NoTagStyler)
235
224
  ###
236
225
  module NoTagStylable
237
226
  include Styler
238
-
227
+
239
228
  # If +node.tag+ is settable, set it to nil.
240
- #
229
+ #
241
230
  # @see Styler#style
242
231
  def style(sniffer,node)
243
232
  node.tag = nil if node.respond_to?(:tag=)
244
233
  end
245
234
  end
246
-
235
+
247
236
  ###
248
237
  # (see Stylers::SeqFlowStyler)
249
238
  ###
250
239
  module SeqFlowStylable
251
240
  include StyleStylable
252
-
241
+
253
242
  # (see StyleStylable#initialize)
254
243
  # @!method initialize(min_level=0,new_style: nil,**kargs)
255
- #
244
+ #
256
245
  # If +new_style+ is nil (the default), then {SEQUENCE_FLOW} will be used.
257
246
  def initialize(*)
258
247
  super
259
-
260
- @new_style = SEQUENCE_FLOW if @new_style.nil?()
248
+
249
+ @new_style = SEQUENCE_FLOW if @new_style.nil?
261
250
  end
262
-
251
+
263
252
  # Change the style of a Sequence to FLOW (or to the value of {new_style})
264
253
  # if it is >= {min_level}.
265
- #
254
+ #
266
255
  # @see change_style
267
256
  # @see Styler#style_sequence
268
257
  def style_sequence(sniffer,node)
@@ -1,22 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  #--
5
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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
20
9
  #++
21
10
 
22
11
 
@@ -27,36 +16,36 @@ require 'psychgus/styled_tree_builder'
27
16
  module Psychgus
28
17
  ###
29
18
  # Use this wherever Psych::Handlers::DocumentStream would have been used, to enable styling.
30
- #
31
- # @author Jonathan Bradley Whited (@esotericpig)
19
+ #
20
+ # @author Jonathan Bradley Whited
32
21
  # @since 1.0.0
33
- #
22
+ #
34
23
  # @see Psychgus.parse_stream Psychgus.parse_stream
35
24
  # @see Psych::Handlers::DocumentStream
36
25
  ###
37
26
  class StyledDocumentStream < StyledTreeBuilder
38
27
  # Initialize this class with {Styler}(s) and a block.
39
- #
28
+ #
40
29
  # @param stylers [Styler] {Styler}(s) to use for styling this DocumentStream
41
30
  # @param deref_aliases [true,false] whether to dereference aliases; output the actual value
42
31
  # instead of the alias
43
32
  # @param block [Proc] a block to call in {#end_document} to denote a new YAML document
44
33
  def initialize(*stylers,deref_aliases: false,**options,&block)
45
34
  super(*stylers,deref_aliases: deref_aliases,**options)
46
-
35
+
47
36
  @block = block
48
37
  end
49
-
38
+
50
39
  # This mimics the behavior of Psych::Handlers::DocumentStream#end_document.
51
- #
40
+ #
52
41
  # @see Psych::Handlers::DocumentStream#end_document
53
- def end_document(implicit_end=!streaming?())
42
+ def end_document(implicit_end=!streaming?)
54
43
  @last.implicit_end = implicit_end
55
44
  @block.call(pop)
56
45
  end
57
-
46
+
58
47
  # This mimics the behavior of Psych::Handlers::DocumentStream#start_document.
59
- #
48
+ #
60
49
  # @see Psych::Handlers::DocumentStream#start_document
61
50
  def start_document(version,tag_directives,implicit)
62
51
  node = Psych::Nodes::Document.new(version,tag_directives,implicit)
@@ -1,22 +1,11 @@
1
- #!/usr/bin/env ruby
2
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  #--
5
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/>.
6
+ # Copyright (c) 2019-2021 Jonathan Bradley Whited
7
+ #
8
+ # SPDX-License-Identifier: LGPL-3.0-or-later
20
9
  #++
21
10
 
22
11
 
@@ -28,10 +17,10 @@ require 'psychgus/super_sniffer'
28
17
  module Psychgus
29
18
  ###
30
19
  # Use this wherever Psych::TreeBuilder would have been used, to enable styling.
31
- #
32
- # @author Jonathan Bradley Whited (@esotericpig)
20
+ #
21
+ # @author Jonathan Bradley Whited
33
22
  # @since 1.0.0
34
- #
23
+ #
35
24
  # @see Psychgus.parser Psychgus.parser
36
25
  # @see Psychgus.dump_stream Psychgus.dump_stream
37
26
  # @see Psych::TreeBuilder
@@ -40,254 +29,254 @@ module Psychgus
40
29
  # @return [true,false] whether to dereference aliases; output the actual value instead of the alias
41
30
  attr_accessor :deref_aliases
42
31
  alias_method :deref_aliases?,:deref_aliases
43
-
32
+
44
33
  # @return [SuperSniffer] the {SuperSniffer} being used to sniff the YAML nodes, level, etc.
45
34
  attr_reader :sniffer
46
-
35
+
47
36
  # @return [Array<Stylers>] the {Styler}(s) being used to style the YAML nodes
48
37
  attr_reader :stylers
49
-
38
+
50
39
  # Initialize this class with {Styler}(s).
51
- #
40
+ #
52
41
  # @param stylers [Styler] {Styler}(s) to use for styling this TreeBuilder
53
42
  # @param deref_aliases [true,false] whether to dereference aliases; output the actual value
54
43
  # instead of the alias
55
44
  def initialize(*stylers,deref_aliases: false,**options)
56
45
  super()
57
-
46
+
58
47
  @deref_aliases = deref_aliases
59
- @sniffer = SuperSniffer.new()
48
+ @sniffer = SuperSniffer.new
60
49
  @stylers = []
61
-
50
+
62
51
  add_styler(*stylers)
63
52
  end
64
-
53
+
65
54
  # Add {Styler}(s) onto the end of the data structure.
66
- #
55
+ #
67
56
  # @param stylers [Styler] {Styler}(s) to add
68
- #
57
+ #
69
58
  # @return [self] this class
70
59
  def add_styler(*stylers)
71
60
  @stylers.push(*stylers)
72
-
61
+
73
62
  return self
74
63
  end
75
-
64
+
76
65
  # Calls super, styler(s), and sniffer.
77
- #
66
+ #
78
67
  # @see Psych::TreeBuilder#alias
79
68
  # @see Styler#style
80
69
  # @see Styler#style_alias
81
70
  # @see SuperSniffer#add_alias
82
- #
71
+ #
83
72
  # @return [Psych::Nodes::Alias] the alias node created
84
73
  def alias(*)
85
74
  node = super
86
-
75
+
87
76
  @stylers.each do |styler|
88
77
  styler.style(sniffer,node)
89
78
  styler.style_alias(sniffer,node)
90
79
  end
91
-
80
+
92
81
  @sniffer.add_alias(node)
93
-
82
+
94
83
  return node
95
84
  end
96
-
85
+
97
86
  # Calls super and sniffer.
98
- #
87
+ #
99
88
  # @see Psych::TreeBuilder#end_document
100
89
  # @see SuperSniffer#end_document
101
90
  def end_document(*)
102
91
  result = super
103
-
104
- @sniffer.end_document()
105
-
92
+
93
+ @sniffer.end_document
94
+
106
95
  return result
107
96
  end
108
-
97
+
109
98
  # Calls super and sniffer.
110
- #
99
+ #
111
100
  # @see Psych::TreeBuilder#end_mapping
112
101
  # @see SuperSniffer#end_mapping
113
102
  def end_mapping(*)
114
103
  result = super
115
-
116
- @sniffer.end_mapping()
117
-
104
+
105
+ @sniffer.end_mapping
106
+
118
107
  return result
119
108
  end
120
-
109
+
121
110
  # Calls super and sniffer.
122
- #
111
+ #
123
112
  # @see Psych::TreeBuilder#end_sequence
124
113
  # @see SuperSniffer#end_sequence
125
114
  def end_sequence(*)
126
115
  result = super
127
-
128
- @sniffer.end_sequence()
129
-
116
+
117
+ @sniffer.end_sequence
118
+
130
119
  return result
131
120
  end
132
-
121
+
133
122
  # Calls super and sniffer.
134
- #
123
+ #
135
124
  # @see Psych::TreeBuilder#end_stream
136
125
  # @see SuperSniffer#end_stream
137
126
  def end_stream(*)
138
127
  result = super
139
-
140
- @sniffer.end_stream()
141
-
128
+
129
+ @sniffer.end_stream
130
+
142
131
  return result
143
132
  end
144
-
133
+
145
134
  # Insert {Styler}(s) at +index+ into the data structure.
146
- #
135
+ #
147
136
  # @param stylers [Styler] {Styler}(s) to insert
148
- #
137
+ #
149
138
  # @return [self] this class
150
139
  def insert_styler(index,*stylers)
151
140
  @stylers.insert(index,*stylers)
152
-
141
+
153
142
  return self
154
143
  end
155
-
144
+
156
145
  # Remove the last {Styler}(s) from the data structure.
157
- #
146
+ #
158
147
  # @param count [Integer] the optional amount of tail elements to pop
159
- #
148
+ #
160
149
  # @return [Styler,Array<Styler>,nil] the last {Styler}(s), or if empty or count==0, nil
161
150
  def pop_styler(count=1)
162
151
  return nil if count == 0
163
- return @stylers.pop() if count == 1
164
-
152
+ return @stylers.pop if count == 1
153
+
165
154
  return @stylers.pop(count)
166
155
  end
167
-
156
+
168
157
  # Remove the {Styler} that matches +styler+ from the data structure.
169
- #
158
+ #
170
159
  # An optional +block+ can return a default value if not found.
171
- #
160
+ #
172
161
  # @param styler [Styler] the {Styler} to find and remove
173
162
  # @param block [Proc] an optional block to call when +styler+ is not found
174
- #
163
+ #
175
164
  # @return [Styler,nil] the last {Styler}, or if not found, nil or the result of +block+
176
165
  def remove_styler(styler,&block)
177
166
  return @stylers.delete(styler,&block)
178
167
  end
179
-
168
+
180
169
  # Remove the {Styler} at +index+ from the data structure.
181
- #
170
+ #
182
171
  # @param index [Integer] the index of the {Styler} to remove
183
- #
172
+ #
184
173
  # @return [Styler,nil] the {Styler} removed or nil if empty
185
174
  def remove_styler_at(index)
186
175
  return @stylers.delete_at(index)
187
176
  end
188
-
177
+
189
178
  # Calls super, styler(s), and sniffer.
190
- #
179
+ #
191
180
  # @see Psych::TreeBuilder#scalar
192
181
  # @see Styler#style
193
182
  # @see Styler#style_scalar
194
183
  # @see SuperSniffer#add_scalar
195
- #
184
+ #
196
185
  # @return [Psych::Nodes::Scalar] the scalar node created
197
186
  def scalar(*)
198
187
  node = super
199
-
188
+
200
189
  @stylers.each do |styler|
201
190
  styler.style(sniffer,node)
202
191
  styler.style_scalar(sniffer,node)
203
192
  end
204
-
193
+
205
194
  @sniffer.add_scalar(node)
206
-
195
+
207
196
  return node
208
197
  end
209
-
198
+
210
199
  # Calls super, styler(s), and sniffer.
211
- #
200
+ #
212
201
  # @see Psych::TreeBuilder#start_document
213
202
  # @see Styler#style
214
203
  # @see Styler#style_document
215
204
  # @see SuperSniffer#start_document
216
- #
205
+ #
217
206
  # @return [Psych::Nodes::Document] the document node created
218
207
  def start_document(*)
219
208
  node = super
220
-
209
+
221
210
  @stylers.each do |styler|
222
211
  styler.style(sniffer,node)
223
212
  styler.style_document(sniffer,node)
224
213
  end
225
-
214
+
226
215
  @sniffer.start_document(node)
227
-
216
+
228
217
  return node
229
218
  end
230
-
219
+
231
220
  # Calls super, styler(s), and sniffer.
232
- #
221
+ #
233
222
  # @see Psych::TreeBuilder#start_mapping
234
223
  # @see Styler#style
235
224
  # @see Styler#style_mapping
236
225
  # @see SuperSniffer#start_mapping
237
- #
226
+ #
238
227
  # @return [Psych::Nodes::Mapping] the mapping node created
239
228
  def start_mapping(*)
240
229
  node = super
241
-
230
+
242
231
  @stylers.each do |styler|
243
232
  styler.style(sniffer,node)
244
233
  styler.style_mapping(sniffer,node)
245
234
  end
246
-
235
+
247
236
  @sniffer.start_mapping(node)
248
-
237
+
249
238
  return node
250
239
  end
251
-
240
+
252
241
  # Calls super, styler(s), and sniffer.
253
- #
242
+ #
254
243
  # @see Psych::TreeBuilder#start_sequence
255
244
  # @see Styler#style
256
245
  # @see Styler#style_sequence
257
246
  # @see SuperSniffer#start_sequence
258
- #
247
+ #
259
248
  # @return [Psych::Nodes::Sequence] the sequence node created
260
249
  def start_sequence(*)
261
250
  node = super
262
-
251
+
263
252
  @stylers.each do |styler|
264
253
  styler.style(sniffer,node)
265
254
  styler.style_sequence(sniffer,node)
266
255
  end
267
-
256
+
268
257
  @sniffer.start_sequence(node)
269
-
258
+
270
259
  return node
271
260
  end
272
-
261
+
273
262
  # Calls super, styler(s), and sniffer.
274
- #
263
+ #
275
264
  # @see Psych::TreeBuilder#start_stream
276
265
  # @see Styler#style
277
266
  # @see Styler#style_stream
278
267
  # @see SuperSniffer#start_stream
279
- #
268
+ #
280
269
  # @return [Psych::Nodes::Stream] the stream node created
281
270
  def start_stream(*)
282
271
  node = super
283
-
272
+
284
273
  @stylers.each do |styler|
285
274
  styler.style(sniffer,node)
286
275
  styler.style_stream(sniffer,node)
287
276
  end
288
-
277
+
289
278
  @sniffer.start_stream(node)
290
-
279
+
291
280
  return node
292
281
  end
293
282
  end