D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
gems
/
gems
/
psych-3.0.2
/
lib
/
psych
/
nodes
/
Filename :
node.rb
back
Copy
# frozen_string_literal: true require 'stringio' require 'psych/class_loader' require 'psych/scalar_scanner' module Psych module Nodes ### # The base class for any Node in a YAML parse tree. This class should # never be instantiated. class Node include Enumerable # The children of this node attr_reader :children # An associated tag attr_reader :tag # The line number where this node start attr_accessor :start_line # The column number where this node start attr_accessor :start_column # The line number where this node ends attr_accessor :end_line # The column number where this node ends attr_accessor :end_column # Create a new Psych::Nodes::Node def initialize @children = [] end ### # Iterate over each node in the tree. Yields each node to +block+ depth # first. def each &block return enum_for :each unless block_given? Visitors::DepthFirst.new(block).accept self end ### # Convert this node to Ruby. # # See also Psych::Visitors::ToRuby def to_ruby Visitors::ToRuby.create.accept(self) end alias :transform :to_ruby ### # Convert this node to YAML. # # See also Psych::Visitors::Emitter def yaml io = nil, options = {} real_io = io || StringIO.new(''.encode('utf-8')) Visitors::Emitter.new(real_io, options).accept self return real_io.string unless io io end alias :to_yaml :yaml end end end
Name
Size
Last Modified
Owner
Permissions
Actions
alias.rb
0.482
KB
December 06 2024 2:24:35
root
0644
document.rb
1.782
KB
December 06 2024 2:24:35
root
0644
mapping.rb
1.51
KB
December 06 2024 2:24:35
root
0644
node.rb
1.574
KB
December 06 2024 2:24:35
root
0644
scalar.rb
1.599
KB
December 06 2024 2:24:35
root
0644
sequence.rb
2.001
KB
December 06 2024 2:24:35
root
0644
stream.rb
0.972
KB
December 06 2024 2:24:35
root
0644
2017 © D7net | D704T team