Class: Ya2YAML
Overview
- Author
-
Akira FUNAI
- Copyright
-
Copyright © 2006-2010 Akira FUNAI
- License
-
MIT License
Defined Under Namespace
Modules: Constants
Constant Summary
Constants included from Constants
Constants::ESCAPE_SEQ, Constants::ESCAPE_SEQ_LB, Constants::ESCAPE_SEQ_NS, Constants::ESCAPE_SEQ_WS, Constants::REX_ANY_LB, Constants::REX_BOOL, Constants::REX_CR, Constants::REX_CRLF, Constants::REX_FLOAT, Constants::REX_INT, Constants::REX_LF, Constants::REX_LS, Constants::REX_MERGE, Constants::REX_NEL, Constants::REX_NORMAL_LB, Constants::REX_NULL, Constants::REX_PS, Constants::REX_TIMESTAMP, Constants::REX_VALUE, Constants::UCS_0X2028, Constants::UCS_0X2029, Constants::UCS_0X85, Constants::UCS_0XA0
Instance Method Summary collapse
- #_ya2yaml(obj) ⇒ Object
-
#initialize(opts = {}) ⇒ Ya2YAML
constructor
A new instance of Ya2YAML.
Constructor Details
#initialize(opts = {}) ⇒ Ya2YAML
Returns a new instance of Ya2YAML.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ya2yaml.rb', line 9 def initialize(opts = {}) = opts.dup [:indent_size] = 2 if [:indent_size].to_i <= 0 [:minimum_block_length] = 0 if [:minimum_block_length].to_i <= 0 .update( { :printable_with_syck => true, :escape_b_specific => true, :escape_as_utf8 => true, } ) if [:syck_compatible] @options = end |
Instance Method Details
#_ya2yaml(obj) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/ya2yaml.rb', line 24 def _ya2yaml(obj) raise 'set $KCODE to "UTF8".' if (RUBY_VERSION < '1.9.0') && ($KCODE != 'UTF8') '--- ' + emit(obj, 1) + "\n" rescue SystemStackError raise ArgumentError, "ya2yaml can't handle circular references" end |