Class: Ya2YAML
Overview
$Id: ya2yaml.rb,v 0.24 2006-11-06 01:15:07+09 funai Exp funai $
- Author
-
Akira FUNAI
- Copyright
-
Copyright © 2006 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(options = {}) ⇒ Ya2YAML
constructor
A new instance of Ya2YAML.
Constructor Details
#initialize(options = {}) ⇒ Ya2YAML
Returns a new instance of Ya2YAML.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ya2yaml.rb', line 11 def initialize( = {}) [: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
25 26 27 28 |
# File 'lib/ya2yaml.rb', line 25 def _ya2yaml(obj) throw 'set $KCODE to "UTF8".' if $KCODE != 'UTF8' '--- ' + emit(obj,1) + "\n" end |