module Psych::Comments
Constants
- VERSION
Public Class Methods
Source
# File lib/psych/comments/emitter.rb, line 312 def self.emit_yaml(node) emitter = Emitter.new emitter.emit(node) emitter.out end
Source
# File lib/psych/comments/parsing.rb, line 85 def self.parse(yaml, filename: nil) parse_stream(yaml, filename: filename) do |node| return node end false end
Source
# File lib/psych/comments/parsing.rb, line 92 def self.parse_file(filename) File.open filename, 'r:bom|utf-8' do |f| parse f, filename: filename end end
Source
# File lib/psych/comments/parsing.rb, line 98 def self.parse_stream(yaml, filename: nil, &block) filename ||= yaml.respond_to?(:path) ? yaml.path : "<unknown>" yaml = yaml.read if yaml.respond_to?(:read) ast = Psych.parse_stream(yaml, filename: filename) Analyzer.new(yaml).visit(ast) if block_given? ast.children.each do |doc| block.(doc) end nil else ast end end