1module Psych 2 module Nodes 3 ### 4 # This class represents a {YAML Scalar}[http://yaml.org/spec/1.1/#id858081]. 5 # 6 # This node type is a terminal node and should not have any children. 7 class Scalar < Psych::Nodes::Node 8 # Any style scalar, the emitter chooses 9 ANY = 0 10 11 # Plain scalar style 12 PLAIN = 1 13 14 # Single quoted style 15 SINGLE_QUOTED = 2 16 17 # Double quoted style 18 DOUBLE_QUOTED = 3 19 20 # Literal style 21 LITERAL = 4 22 23 # Folded style 24 FOLDED = 5 25 26 # The scalar value 27 attr_accessor :value 28 29 # The anchor value (if there is one) 30 attr_accessor :anchor 31 32 # The tag value (if there is one) 33 attr_accessor :tag 34 35 # Is this a plain scalar? 36 attr_accessor :plain 37 38 # Is this scalar quoted? 39 attr_accessor :quoted 40 41 # The style of this scalar 42 attr_accessor :style 43 44 ### 45 # Create a new Psych::Nodes::Scalar object. 46 # 47 # +value+ is the string value of the scalar 48 # +anchor+ is an associated anchor or nil 49 # +tag+ is an associated tag or nil 50 # +plain+ is a boolean value 51 # +quoted+ is a boolean value 52 # +style+ is an integer idicating the string style 53 # 54 # == See Also 55 # 56 # See also Psych::Handler#scalar 57 def initialize value, anchor = nil, tag = nil, plain = true, quoted = false, style = ANY 58 @value = value 59 @anchor = anchor 60 @tag = tag 61 @plain = plain 62 @quoted = quoted 63 @style = style 64 end 65 end 66 end 67end 68