Class: Yamlint::Parser::TokenParser::Handler

Inherits:
Psych::Handler
  • Object
show all
Defined in:
lib/yamlint/parser/token_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandler

Returns a new instance of Handler.



11
12
13
14
15
# File 'lib/yamlint/parser/token_parser.rb', line 11

def initialize
  super
  @tokens = []
  @parser = nil
end

Instance Attribute Details

#parser=(value) ⇒ Object (writeonly)

Sets the attribute parser

Parameters:

  • value

    the value to set the attribute parser to.



17
18
19
# File 'lib/yamlint/parser/token_parser.rb', line 17

def parser=(value)
  @parser = value
end

#tokensObject (readonly)

Returns the value of attribute tokens.



9
10
11
# File 'lib/yamlint/parser/token_parser.rb', line 9

def tokens
  @tokens
end

Instance Method Details

#alias(anchor) ⇒ Object



55
56
57
# File 'lib/yamlint/parser/token_parser.rb', line 55

def alias(anchor)
  add_token(:alias, anchor:)
end

#end_document(implicit) ⇒ Object



31
32
33
# File 'lib/yamlint/parser/token_parser.rb', line 31

def end_document(implicit)
  add_token(:document_end, implicit:)
end

#end_mappingObject



39
40
41
# File 'lib/yamlint/parser/token_parser.rb', line 39

def end_mapping
  add_token(:mapping_end)
end

#end_sequenceObject



47
48
49
# File 'lib/yamlint/parser/token_parser.rb', line 47

def end_sequence
  add_token(:sequence_end)
end

#end_streamObject



23
24
25
# File 'lib/yamlint/parser/token_parser.rb', line 23

def end_stream
  add_token(:stream_end)
end

#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object



51
52
53
# File 'lib/yamlint/parser/token_parser.rb', line 51

def scalar(value, anchor, tag, plain, quoted, style)
  add_token(:scalar, value:, anchor:, tag:, plain:, quoted:, style:)
end

#start_document(version, tag_directives, implicit) ⇒ Object



27
28
29
# File 'lib/yamlint/parser/token_parser.rb', line 27

def start_document(version, tag_directives, implicit)
  add_token(:document_start, version:, tag_directives:, implicit:)
end

#start_mapping(anchor, tag, implicit, style) ⇒ Object



35
36
37
# File 'lib/yamlint/parser/token_parser.rb', line 35

def start_mapping(anchor, tag, implicit, style)
  add_token(:mapping_start, anchor:, tag:, implicit:, style:)
end

#start_sequence(anchor, tag, implicit, style) ⇒ Object



43
44
45
# File 'lib/yamlint/parser/token_parser.rb', line 43

def start_sequence(anchor, tag, implicit, style)
  add_token(:sequence_start, anchor:, tag:, implicit:, style:)
end

#start_stream(encoding) ⇒ Object



19
20
21
# File 'lib/yamlint/parser/token_parser.rb', line 19

def start_stream(encoding)
  add_token(:stream_start, encoding:)
end