Class: String
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.yaml_new(klass, tag, val) ⇒ Object
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/rbyaml.rb', line 302 def String.yaml_new( klass, tag, val ) val = val.unpack("m")[0] if tag == "tag:yaml.org,2002:binary" val = { 'str' => val } if String === val if Hash === val s = klass.allocate # Thank you, NaHi String.instance_method(:initialize). bind(s). call( val.delete( 'str' ) ) val.each { |k,v| s.instance_variable_set( k, v ) } s else raise RbYAML::TypeError, "Invalid String: " + val.inspect end end |
Instance Method Details
#__is_str ⇒ Object
9 |
# File 'lib/rbyaml/util.rb', line 9 def __is_str; true end |
#is_binary_data? ⇒ Boolean
299 300 301 |
# File 'lib/rbyaml.rb', line 299 def is_binary_data? ( self.count( "^ -~", "^\r\n" ) / self.size > 0.3 || self.count( "\x00" ) > 0 ) unless empty? end |
#is_complex_yaml? ⇒ Boolean
296 297 298 |
# File 'lib/rbyaml.rb', line 296 def is_complex_yaml? to_yaml_style or not to_yaml_properties.empty? or self =~ /\n.+/ end |