Class: TreeBuilderWithLines
- Inherits:
-
Psych::TreeBuilder
- Object
- Psych::TreeBuilder
- TreeBuilderWithLines
- Defined in:
- lib/claws/cli/yaml_with_lines.rb
Instance Attribute Summary collapse
-
#parser ⇒ Object
Returns the value of attribute parser.
Instance Method Summary collapse
-
#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object
rubocop:disable Metrics/ParameterLists.
- #start_document(version, tag_directives, implicit) ⇒ Object
- #start_mapping(anchor, tag, implicit, style) ⇒ Object
- #start_sequence(anchor, tag, implicit, style) ⇒ Object
- #start_stream(encoding) ⇒ Object
Instance Attribute Details
#parser ⇒ Object
Returns the value of attribute parser.
71 72 73 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 71 def parser @parser end |
Instance Method Details
#scalar(value, anchor, tag, plain, quoted, style) ⇒ Object
rubocop:disable Metrics/ParameterLists
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 73 def scalar(value, anchor, tag, plain, quoted, style) # rubocop:disable Metrics/ParameterLists # github uses "on" in its schema for workflows, which # YAML 1.1 turns into a boolean. YAML 1.2 does not, but # Psych doesn't support that. # https://github.com/ruby/psych/blob/56d545e278/test/psych/test_boolean.rb#L9-L13 quoted = true if value.downcase == "on" super(value, anchor, tag, plain, quoted, style).tap do |l| l.line = parser.mark.line end end |
#start_document(version, tag_directives, implicit) ⇒ Object
85 86 87 88 89 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 85 def start_document(version, tag_directives, implicit) super(version, tag_directives, implicit).tap do |l| l.line = parser.mark.line end end |
#start_mapping(anchor, tag, implicit, style) ⇒ Object
103 104 105 106 107 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 103 def start_mapping(anchor, tag, implicit, style) super(anchor, tag, implicit, style).tap do |l| l.line = parser.mark.line end end |
#start_sequence(anchor, tag, implicit, style) ⇒ Object
91 92 93 94 95 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 91 def start_sequence(anchor, tag, implicit, style) super(anchor, tag, implicit, style).tap do |l| l.line = parser.mark.line end end |
#start_stream(encoding) ⇒ Object
97 98 99 100 101 |
# File 'lib/claws/cli/yaml_with_lines.rb', line 97 def start_stream(encoding) super(encoding).tap do |l| l.line = parser.mark.line end end |