mkrf 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +2 -0
- data/MIT-LICENSE +7 -0
- data/README +54 -0
- data/Rakefile +107 -0
- data/lib/mkrf.rb +4 -0
- data/lib/mkrf/availability.rb +219 -0
- data/lib/mkrf/generator.rb +146 -0
- data/test/abstract_unit.rb +4 -0
- data/test/fixtures/down_a_directory/header_down_a_directory.h +1 -0
- data/test/fixtures/stdmkrf.h +1 -0
- data/test/sample_files/libtrivial/Rakefile +31 -0
- data/test/sample_files/libtrivial/extconf.rb +3 -0
- data/test/sample_files/libtrivial/lib/libtrivial.c +5 -0
- data/test/sample_files/libtrivial/lib/libtrivial.o +0 -0
- data/test/sample_files/libtrivial/libtrivial_so.bundle +0 -0
- data/test/sample_files/libtrivial/mkrf.log +1 -0
- data/test/sample_files/libxml-ruby-0.3.8/CHANGELOG +74 -0
- data/test/sample_files/libxml-ruby-0.3.8/LICENSE +22 -0
- data/test/sample_files/libxml-ruby-0.3.8/README +144 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/cbg.c +76 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/extconf.rb +49 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.c +86 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.h +82 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/libxml.rb +107 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/mkrf.log +1 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/old_extconf.rb +95 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.c +372 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attr.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.c +224 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_attribute.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.c +1159 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_document.h +27 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.c +168 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_dtd.h +17 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.c +167 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_input_cbg.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.c +2139 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node.h +28 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.c +248 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_node_set.h +26 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.c +153 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_ns.h +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.c +1417 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser.h +31 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.c +715 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_parser_context.h +22 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.c +426 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_sax_parser.h +52 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.c +142 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_schema.h +16 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.c +43 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_tree.h +12 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.c +20 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xinclude.h +13 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.c +363 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath.h +24 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.c +125 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpath_context.h +24 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.c +100 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer.h +27 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.c +21 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/ruby_xml_xpointer_context.h +18 -0
- data/test/sample_files/libxml-ruby-0.3.8/ext/xml/sax_parser_callbacks.inc +202 -0
- data/test/sample_files/syck-0.55/CHANGELOG +186 -0
- data/test/sample_files/syck-0.55/COPYING +54 -0
- data/test/sample_files/syck-0.55/Makefile +582 -0
- data/test/sample_files/syck-0.55/Makefile.am +5 -0
- data/test/sample_files/syck-0.55/Makefile.in +582 -0
- data/test/sample_files/syck-0.55/README +105 -0
- data/test/sample_files/syck-0.55/README.BYTECODE +484 -0
- data/test/sample_files/syck-0.55/README.EXT +444 -0
- data/test/sample_files/syck-0.55/RELEASE +123 -0
- data/test/sample_files/syck-0.55/TODO +25 -0
- data/test/sample_files/syck-0.55/aclocal.m4 +883 -0
- data/test/sample_files/syck-0.55/bootstrap +7 -0
- data/test/sample_files/syck-0.55/config.h +79 -0
- data/test/sample_files/syck-0.55/config.h.in +78 -0
- data/test/sample_files/syck-0.55/config.status +1197 -0
- data/test/sample_files/syck-0.55/config/README +14 -0
- data/test/sample_files/syck-0.55/config/depcomp +529 -0
- data/test/sample_files/syck-0.55/config/install-sh +323 -0
- data/test/sample_files/syck-0.55/config/missing +357 -0
- data/test/sample_files/syck-0.55/configure +6728 -0
- data/test/sample_files/syck-0.55/configure.in +36 -0
- data/test/sample_files/syck-0.55/ext/ruby/CHANGELOG +303 -0
- data/test/sample_files/syck-0.55/ext/ruby/README +400 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/MANIFEST +1 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/bytecode.c +1170 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/emitter.c +1224 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/extconf.rb +10 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.c +1894 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/gram.h +79 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/handler.c +174 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/implicit.c +2989 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/mkrf.log +1 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/node.c +407 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/rubyext.c +2385 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.c +504 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/syck.h +458 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/token.c +2707 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yaml2byte.c +250 -0
- data/test/sample_files/syck-0.55/ext/ruby/ext/syck/yamlbyte.h +170 -0
- data/test/sample_files/syck-0.55/ext/ruby/install.rb +1022 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay.rb +161 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay/news.rb +69 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/okay/rpc.rb +434 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml.rb +436 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/baseemitter.rb +247 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/basenode.rb +216 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/compat.rb +26 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/constants.rb +45 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/dbm.rb +111 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/emitter.rb +107 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/encoding.rb +33 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/error.rb +34 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/rubytypes.rb +438 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/store.rb +29 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stream.rb +40 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/stringio.rb +83 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/syck.rb +19 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/tag.rb +86 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/types.rb +188 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/yamlnode.rb +54 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yaml/ypath.rb +52 -0
- data/test/sample_files/syck-0.55/ext/ruby/lib/yod.rb +1168 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-modules.rb +27 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-sample.rb +336 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayNews-validate.rb +341 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-client.rb +51 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/okayRpc-server.rb +85 -0
- data/test/sample_files/syck-0.55/ext/ruby/samples/yaml-sortHashKeys.rb +128 -0
- data/test/sample_files/syck-0.55/ext/ruby/tests/basic.rb +1653 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsAnchorAlias.yml +51 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBasicTests.yml +282 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockMapping.yml +78 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsBlockSequence.yml +0 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsDocumentSeparator.yml +102 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsErrorTests.yml +23 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFlowCollections.yml +73 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsFoldedScalars.yml +215 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsMapInSeq.yml +0 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsNullsAndEmpties.yml +66 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsRubyTests.yml +182 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsSpecificationExamples.yml +2699 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsTypeTransfers.yml +265 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/YtsYpath.yml +221 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/cookbook.rb +159 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/index.yml +10 -0
- data/test/sample_files/syck-0.55/ext/ruby/yts/yts.rb +193 -0
- data/test/sample_files/syck-0.55/lib/Makefile +497 -0
- data/test/sample_files/syck-0.55/lib/Makefile.am +27 -0
- data/test/sample_files/syck-0.55/lib/Makefile.in +497 -0
- data/test/sample_files/syck-0.55/lib/bytecode.c +1170 -0
- data/test/sample_files/syck-0.55/lib/bytecode.re +525 -0
- data/test/sample_files/syck-0.55/lib/emitter.c +1224 -0
- data/test/sample_files/syck-0.55/lib/gram.c +1894 -0
- data/test/sample_files/syck-0.55/lib/gram.h +79 -0
- data/test/sample_files/syck-0.55/lib/gram.output +2005 -0
- data/test/sample_files/syck-0.55/lib/gram.y +481 -0
- data/test/sample_files/syck-0.55/lib/handler.c +174 -0
- data/test/sample_files/syck-0.55/lib/implicit.c +2989 -0
- data/test/sample_files/syck-0.55/lib/implicit.re +206 -0
- data/test/sample_files/syck-0.55/lib/node.c +407 -0
- data/test/sample_files/syck-0.55/lib/syck.c +504 -0
- data/test/sample_files/syck-0.55/lib/syck.h +458 -0
- data/test/sample_files/syck-0.55/lib/syck_st.c +577 -0
- data/test/sample_files/syck-0.55/lib/syck_st.h +46 -0
- data/test/sample_files/syck-0.55/lib/token.c +2707 -0
- data/test/sample_files/syck-0.55/lib/token.re +1139 -0
- data/test/sample_files/syck-0.55/lib/yaml2byte.c +250 -0
- data/test/sample_files/syck-0.55/lib/yamlbyte.h +170 -0
- data/test/sample_files/syck-0.55/stamp-h1 +1 -0
- data/test/sample_files/syck-0.55/tests/Basic.c +141 -0
- data/test/sample_files/syck-0.55/tests/CuTest.c +294 -0
- data/test/sample_files/syck-0.55/tests/CuTest.h +84 -0
- data/test/sample_files/syck-0.55/tests/Emit.c +87 -0
- data/test/sample_files/syck-0.55/tests/Makefile +480 -0
- data/test/sample_files/syck-0.55/tests/Makefile.am +13 -0
- data/test/sample_files/syck-0.55/tests/Makefile.in +480 -0
- data/test/sample_files/syck-0.55/tests/Parse.c +208 -0
- data/test/sample_files/syck-0.55/tests/YTS.c +2310 -0
- data/test/sample_files/syck-0.55/tests/YTS.c.erb +326 -0
- data/test/sample_files/syck-0.55/tests/YTS.c.rb +44 -0
- data/test/test_availability.rb +68 -0
- data/test/test_generator.rb +74 -0
- metadata +252 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*- vim: sw=4 ts=4
|
|
2
|
+
# $Id: yaml.rb,v 1.30 2005/04/07 16:22:02 why Exp $
|
|
3
|
+
#
|
|
4
|
+
# = yaml.rb: top-level module with methods for loading and parsing YAML documents
|
|
5
|
+
#
|
|
6
|
+
# Author:: why the lucky stiff
|
|
7
|
+
#
|
|
8
|
+
|
|
9
|
+
require 'stringio'
|
|
10
|
+
require 'yaml/compat'
|
|
11
|
+
require 'yaml/error'
|
|
12
|
+
require 'yaml/syck'
|
|
13
|
+
require 'yaml/tag'
|
|
14
|
+
require 'yaml/stream'
|
|
15
|
+
|
|
16
|
+
# == YAML
|
|
17
|
+
#
|
|
18
|
+
# YAML(tm) (rhymes with 'camel') is a
|
|
19
|
+
# straightforward machine parsable data serialization format designed for
|
|
20
|
+
# human readability and interaction with scripting languages such as Perl
|
|
21
|
+
# and Python. YAML is optimized for data serialization, formatted
|
|
22
|
+
# dumping, configuration files, log files, Internet messaging and
|
|
23
|
+
# filtering. This specification describes the YAML information model and
|
|
24
|
+
# serialization format. Together with the Unicode standard for characters, it
|
|
25
|
+
# provides all the information necessary to understand YAML Version 1.0
|
|
26
|
+
# and construct computer programs to process it.
|
|
27
|
+
#
|
|
28
|
+
# See http://yaml.org/ for more information. For a quick tutorial, please
|
|
29
|
+
# visit YAML In Five Minutes (http://yaml.kwiki.org/?YamlInFiveMinutes).
|
|
30
|
+
#
|
|
31
|
+
# == About This Library
|
|
32
|
+
#
|
|
33
|
+
# The YAML 1.0 specification outlines four stages of YAML loading and dumping.
|
|
34
|
+
# This library honors all four of those stages, although data is really only
|
|
35
|
+
# available to you in three stages.
|
|
36
|
+
#
|
|
37
|
+
# The four stages are: native, representation, serialization, and presentation.
|
|
38
|
+
#
|
|
39
|
+
# The native stage refers to data which has been loaded completely into Ruby's
|
|
40
|
+
# own types. (See +YAML::load+.)
|
|
41
|
+
#
|
|
42
|
+
# The representation stage means data which has been composed into
|
|
43
|
+
# +YAML::BaseNode+ objects. In this stage, the document is available as a
|
|
44
|
+
# tree of node objects. You can perform YPath queries and transformations
|
|
45
|
+
# at this level. (See +YAML::parse+.)
|
|
46
|
+
#
|
|
47
|
+
# The serialization stage happens inside the parser. The YAML parser used in
|
|
48
|
+
# Ruby is called Syck. Serialized nodes are available in the extension as
|
|
49
|
+
# SyckNode structs.
|
|
50
|
+
#
|
|
51
|
+
# The presentation stage is the YAML document itself. This is accessible
|
|
52
|
+
# to you as a string. (See +YAML::dump+.)
|
|
53
|
+
#
|
|
54
|
+
# For more information about the various information models, see Chapter
|
|
55
|
+
# 3 of the YAML 1.0 Specification (http://yaml.org/spec/#id2491269).
|
|
56
|
+
#
|
|
57
|
+
# The YAML module provides quick access to the most common loading (YAML::load)
|
|
58
|
+
# and dumping (YAML::dump) tasks. This module also provides an API for registering
|
|
59
|
+
# global types (YAML::add_domain_type).
|
|
60
|
+
#
|
|
61
|
+
# == Example
|
|
62
|
+
#
|
|
63
|
+
# A simple round-trip (load and dump) of an object.
|
|
64
|
+
#
|
|
65
|
+
# require "yaml"
|
|
66
|
+
#
|
|
67
|
+
# test_obj = ["dogs", "cats", "badgers"]
|
|
68
|
+
#
|
|
69
|
+
# yaml_obj = YAML::dump( test_obj )
|
|
70
|
+
# # -> ---
|
|
71
|
+
# - dogs
|
|
72
|
+
# - cats
|
|
73
|
+
# - badgers
|
|
74
|
+
# ruby_obj = YAML::load( yaml_obj )
|
|
75
|
+
# # => ["dogs", "cats", "badgers"]
|
|
76
|
+
# ruby_obj == test_obj
|
|
77
|
+
# # => true
|
|
78
|
+
#
|
|
79
|
+
# To register your custom types with the global resolver, use +add_domain_type+.
|
|
80
|
+
#
|
|
81
|
+
# YAML::add_domain_type( "your-site.com,2004", "widget" ) do |type, val|
|
|
82
|
+
# Widget.new( val )
|
|
83
|
+
# end
|
|
84
|
+
#
|
|
85
|
+
module YAML
|
|
86
|
+
|
|
87
|
+
Resolver = YAML::Syck::Resolver
|
|
88
|
+
DefaultResolver = YAML::Syck::DefaultResolver
|
|
89
|
+
DefaultResolver.use_types_at( @@tagged_classes )
|
|
90
|
+
GenericResolver = YAML::Syck::GenericResolver
|
|
91
|
+
Parser = YAML::Syck::Parser
|
|
92
|
+
Emitter = YAML::Syck::Emitter
|
|
93
|
+
|
|
94
|
+
# Returns a new default parser
|
|
95
|
+
def YAML.parser; Parser.new.set_resolver( YAML.resolver ); end
|
|
96
|
+
# Returns a new generic parser
|
|
97
|
+
def YAML.generic_parser; Parser.new.set_resolver( GenericResolver ); end
|
|
98
|
+
# Returns the default resolver
|
|
99
|
+
def YAML.resolver; DefaultResolver; end
|
|
100
|
+
# Returns a new default emitter
|
|
101
|
+
def YAML.emitter; Emitter.new.set_resolver( YAML.resolver ); end
|
|
102
|
+
|
|
103
|
+
#
|
|
104
|
+
# Converts _obj_ to YAML and writes the YAML result to _io_.
|
|
105
|
+
#
|
|
106
|
+
# File.open( 'animals.yaml', 'w' ) do |out|
|
|
107
|
+
# YAML.dump( ['badger', 'elephant', 'tiger'], out )
|
|
108
|
+
# end
|
|
109
|
+
#
|
|
110
|
+
# If no _io_ is provided, a string containing the dumped YAML
|
|
111
|
+
# is returned.
|
|
112
|
+
#
|
|
113
|
+
# YAML.dump( :locked )
|
|
114
|
+
# #=> "--- :locked"
|
|
115
|
+
#
|
|
116
|
+
def YAML.dump( obj, io = nil )
|
|
117
|
+
obj.to_yaml( io || io2 = StringIO.new )
|
|
118
|
+
io || ( io2.rewind; io2.read )
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
#
|
|
122
|
+
# Load a document from the current _io_ stream.
|
|
123
|
+
#
|
|
124
|
+
# File.open( 'animals.yaml' ) { |yf| YAML::load( yf ) }
|
|
125
|
+
# #=> ['badger', 'elephant', 'tiger']
|
|
126
|
+
#
|
|
127
|
+
# Can also load from a string.
|
|
128
|
+
#
|
|
129
|
+
# YAML.load( "--- :locked" )
|
|
130
|
+
# #=> :locked
|
|
131
|
+
#
|
|
132
|
+
def YAML.load( io )
|
|
133
|
+
yp = parser.load( io )
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
#
|
|
137
|
+
# Load a document from the file located at _filepath_.
|
|
138
|
+
#
|
|
139
|
+
# YAML.load_file( 'animals.yaml' )
|
|
140
|
+
# #=> ['badger', 'elephant', 'tiger']
|
|
141
|
+
#
|
|
142
|
+
def YAML.load_file( filepath )
|
|
143
|
+
File.open( filepath ) do |f|
|
|
144
|
+
load( f )
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
# Parse the first document from the current _io_ stream
|
|
150
|
+
#
|
|
151
|
+
# File.open( 'animals.yaml' ) { |yf| YAML::load( yf ) }
|
|
152
|
+
# #=> #<YAML::Syck::Node:0x82ccce0
|
|
153
|
+
# @kind=:seq,
|
|
154
|
+
# @value=
|
|
155
|
+
# [#<YAML::Syck::Node:0x82ccd94
|
|
156
|
+
# @kind=:scalar,
|
|
157
|
+
# @type_id="str",
|
|
158
|
+
# @value="badger">,
|
|
159
|
+
# #<YAML::Syck::Node:0x82ccd58
|
|
160
|
+
# @kind=:scalar,
|
|
161
|
+
# @type_id="str",
|
|
162
|
+
# @value="elephant">,
|
|
163
|
+
# #<YAML::Syck::Node:0x82ccd1c
|
|
164
|
+
# @kind=:scalar,
|
|
165
|
+
# @type_id="str",
|
|
166
|
+
# @value="tiger">]>
|
|
167
|
+
#
|
|
168
|
+
# Can also load from a string.
|
|
169
|
+
#
|
|
170
|
+
# YAML.parse( "--- :locked" )
|
|
171
|
+
# #=> #<YAML::Syck::Node:0x82edddc
|
|
172
|
+
# @type_id="tag:ruby.yaml.org,2002:sym",
|
|
173
|
+
# @value=":locked", @kind=:scalar>
|
|
174
|
+
#
|
|
175
|
+
def YAML.parse( io )
|
|
176
|
+
yp = generic_parser.load( io )
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
#
|
|
180
|
+
# Parse a document from the file located at _filepath_.
|
|
181
|
+
#
|
|
182
|
+
# YAML.parse_file( 'animals.yaml' )
|
|
183
|
+
# #=> #<YAML::Syck::Node:0x82ccce0
|
|
184
|
+
# @kind=:seq,
|
|
185
|
+
# @value=
|
|
186
|
+
# [#<YAML::Syck::Node:0x82ccd94
|
|
187
|
+
# @kind=:scalar,
|
|
188
|
+
# @type_id="str",
|
|
189
|
+
# @value="badger">,
|
|
190
|
+
# #<YAML::Syck::Node:0x82ccd58
|
|
191
|
+
# @kind=:scalar,
|
|
192
|
+
# @type_id="str",
|
|
193
|
+
# @value="elephant">,
|
|
194
|
+
# #<YAML::Syck::Node:0x82ccd1c
|
|
195
|
+
# @kind=:scalar,
|
|
196
|
+
# @type_id="str",
|
|
197
|
+
# @value="tiger">]>
|
|
198
|
+
#
|
|
199
|
+
def YAML.parse_file( filepath )
|
|
200
|
+
File.open( filepath ) do |f|
|
|
201
|
+
parse( f )
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
#
|
|
206
|
+
# Calls _block_ with each consecutive document in the YAML
|
|
207
|
+
# stream contained in _io_.
|
|
208
|
+
#
|
|
209
|
+
# File.open( 'many-docs.yaml' ) do |yf|
|
|
210
|
+
# YAML.each_document( yf ) do |ydoc|
|
|
211
|
+
# ## ydoc contains the single object
|
|
212
|
+
# ## from the YAML document
|
|
213
|
+
# end
|
|
214
|
+
# end
|
|
215
|
+
#
|
|
216
|
+
def YAML.each_document( io, &block )
|
|
217
|
+
yp = parser.load_documents( io, &block )
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
#
|
|
221
|
+
# Calls _block_ with each consecutive document in the YAML
|
|
222
|
+
# stream contained in _io_.
|
|
223
|
+
#
|
|
224
|
+
# File.open( 'many-docs.yaml' ) do |yf|
|
|
225
|
+
# YAML.load_documents( yf ) do |ydoc|
|
|
226
|
+
# ## ydoc contains the single object
|
|
227
|
+
# ## from the YAML document
|
|
228
|
+
# end
|
|
229
|
+
# end
|
|
230
|
+
#
|
|
231
|
+
def YAML.load_documents( io, &doc_proc )
|
|
232
|
+
YAML.each_document( io, &doc_proc )
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
#
|
|
236
|
+
# Calls _block_ with a tree of +YAML::BaseNodes+, one tree for
|
|
237
|
+
# each consecutive document in the YAML stream contained in _io_.
|
|
238
|
+
#
|
|
239
|
+
# File.open( 'many-docs.yaml' ) do |yf|
|
|
240
|
+
# YAML.each_node( yf ) do |ydoc|
|
|
241
|
+
# ## ydoc contains a tree of nodes
|
|
242
|
+
# ## from the YAML document
|
|
243
|
+
# end
|
|
244
|
+
# end
|
|
245
|
+
#
|
|
246
|
+
def YAML.each_node( io, &doc_proc )
|
|
247
|
+
yp = generic_parser.load_documents( io, &doc_proc )
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
#
|
|
251
|
+
# Calls _block_ with a tree of +YAML::BaseNodes+, one tree for
|
|
252
|
+
# each consecutive document in the YAML stream contained in _io_.
|
|
253
|
+
#
|
|
254
|
+
# File.open( 'many-docs.yaml' ) do |yf|
|
|
255
|
+
# YAML.parse_documents( yf ) do |ydoc|
|
|
256
|
+
# ## ydoc contains a tree of nodes
|
|
257
|
+
# ## from the YAML document
|
|
258
|
+
# end
|
|
259
|
+
# end
|
|
260
|
+
#
|
|
261
|
+
def YAML.parse_documents( io, &doc_proc )
|
|
262
|
+
YAML.each_node( io, &doc_proc )
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
#
|
|
266
|
+
# Loads all documents from the current _io_ stream,
|
|
267
|
+
# returning a +YAML::Stream+ object containing all
|
|
268
|
+
# loaded documents.
|
|
269
|
+
#
|
|
270
|
+
def YAML.load_stream( io )
|
|
271
|
+
d = nil
|
|
272
|
+
parser.load_documents( io ) do |doc|
|
|
273
|
+
d = YAML::Stream.new if not d
|
|
274
|
+
d.add( doc )
|
|
275
|
+
end
|
|
276
|
+
return d
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
#
|
|
280
|
+
# Returns a YAML stream containing each of the items in +objs+,
|
|
281
|
+
# each having their own document.
|
|
282
|
+
#
|
|
283
|
+
# YAML.dump_stream( 0, [], {} )
|
|
284
|
+
# #=> --- 0
|
|
285
|
+
# --- []
|
|
286
|
+
# --- {}
|
|
287
|
+
#
|
|
288
|
+
def YAML.dump_stream( *objs )
|
|
289
|
+
d = YAML::Stream.new
|
|
290
|
+
objs.each do |doc|
|
|
291
|
+
d.add( doc )
|
|
292
|
+
end
|
|
293
|
+
d.emit
|
|
294
|
+
end
|
|
295
|
+
|
|
296
|
+
#
|
|
297
|
+
# Add a global handler for a YAML domain type.
|
|
298
|
+
#
|
|
299
|
+
def YAML.add_domain_type( domain, type_tag, &transfer_proc )
|
|
300
|
+
resolver.add_type( "tag:#{ domain }:#{ type_tag }", transfer_proc )
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
#
|
|
304
|
+
# Add a transfer method for a builtin type
|
|
305
|
+
#
|
|
306
|
+
def YAML.add_builtin_type( type_tag, &transfer_proc )
|
|
307
|
+
resolver.add_type( "tag:yaml.org,2002:#{ type_tag }", transfer_proc )
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
#
|
|
311
|
+
# Add a transfer method for a builtin type
|
|
312
|
+
#
|
|
313
|
+
def YAML.add_ruby_type( type, &transfer_proc )
|
|
314
|
+
resolver.add_type( "tag:ruby.yaml.org,2002:#{ type_tag }", transfer_proc )
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
#
|
|
318
|
+
# Add a private document type
|
|
319
|
+
#
|
|
320
|
+
def YAML.add_private_type( type_re, &transfer_proc )
|
|
321
|
+
resolver.add_type( "x-private:" + type_re, transfer_proc )
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
#
|
|
325
|
+
# Detect typing of a string
|
|
326
|
+
#
|
|
327
|
+
def YAML.detect_implicit( val )
|
|
328
|
+
resolver.detect_implicit( val )
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
#
|
|
332
|
+
# Convert a type_id to a taguri
|
|
333
|
+
#
|
|
334
|
+
def YAML.tagurize( val )
|
|
335
|
+
resolver.tagurize( val )
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
#
|
|
339
|
+
# Apply a transfer method to a Ruby object
|
|
340
|
+
#
|
|
341
|
+
def YAML.transfer( type_id, obj )
|
|
342
|
+
resolver.transfer( YAML.tagurize( type_id ), obj )
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
#
|
|
346
|
+
# Apply any implicit a node may qualify for
|
|
347
|
+
#
|
|
348
|
+
def YAML.try_implicit( obj )
|
|
349
|
+
YAML.transfer( YAML.detect_implicit( obj ), obj )
|
|
350
|
+
end
|
|
351
|
+
|
|
352
|
+
#
|
|
353
|
+
# Method to extract colon-seperated type and class, returning
|
|
354
|
+
# the type and the constant of the class
|
|
355
|
+
#
|
|
356
|
+
def YAML.read_type_class( type, obj_class )
|
|
357
|
+
scheme, domain, type, tclass = type.split( ':', 4 )
|
|
358
|
+
tclass.split( "::" ).each { |c| obj_class = obj_class.const_get( c ) } if tclass
|
|
359
|
+
return [ type, obj_class ]
|
|
360
|
+
end
|
|
361
|
+
|
|
362
|
+
#
|
|
363
|
+
# Allocate blank object
|
|
364
|
+
#
|
|
365
|
+
def YAML.object_maker( obj_class, val )
|
|
366
|
+
if Hash === val
|
|
367
|
+
o = obj_class.allocate
|
|
368
|
+
val.each_pair { |k,v|
|
|
369
|
+
o.instance_variable_set("@#{k}", v)
|
|
370
|
+
}
|
|
371
|
+
o
|
|
372
|
+
else
|
|
373
|
+
raise YAML::Error, "Invalid object explicitly tagged !ruby/Object: " + val.inspect
|
|
374
|
+
end
|
|
375
|
+
end
|
|
376
|
+
|
|
377
|
+
#
|
|
378
|
+
# Allocate an Emitter if needed
|
|
379
|
+
#
|
|
380
|
+
def YAML.quick_emit( oid, opts = {}, &e )
|
|
381
|
+
out =
|
|
382
|
+
if opts.is_a? YAML::Emitter
|
|
383
|
+
opts
|
|
384
|
+
else
|
|
385
|
+
emitter.reset( opts )
|
|
386
|
+
end
|
|
387
|
+
out.emit( oid, &e )
|
|
388
|
+
end
|
|
389
|
+
|
|
390
|
+
end
|
|
391
|
+
|
|
392
|
+
require 'yaml/rubytypes'
|
|
393
|
+
require 'yaml/types'
|
|
394
|
+
|
|
395
|
+
module Kernel # :nodoc:
|
|
396
|
+
#
|
|
397
|
+
# ryan:: You know how Kernel.p is a really convenient way to dump ruby
|
|
398
|
+
# structures? The only downside is that it's not as legible as
|
|
399
|
+
# YAML.
|
|
400
|
+
#
|
|
401
|
+
# _why:: (listening)
|
|
402
|
+
#
|
|
403
|
+
# ryan:: I know you don't want to urinate all over your users' namespaces.
|
|
404
|
+
# But, on the other hand, convenience of dumping for debugging is,
|
|
405
|
+
# IMO, a big YAML use case.
|
|
406
|
+
#
|
|
407
|
+
# _why:: Go nuts! Have a pony parade!
|
|
408
|
+
#
|
|
409
|
+
# ryan:: Either way, I certainly will have a pony parade.
|
|
410
|
+
#
|
|
411
|
+
|
|
412
|
+
# Prints any supplied _objects_ out in YAML. Intended as
|
|
413
|
+
# a variation on +Kernel::p+.
|
|
414
|
+
#
|
|
415
|
+
# S = Struct.new(:name, :state)
|
|
416
|
+
# s = S['dave', 'TX']
|
|
417
|
+
# y s
|
|
418
|
+
#
|
|
419
|
+
# _produces:_
|
|
420
|
+
#
|
|
421
|
+
# --- !ruby/struct:S
|
|
422
|
+
# name: dave
|
|
423
|
+
# state: TX
|
|
424
|
+
#
|
|
425
|
+
def y( object, *objects )
|
|
426
|
+
objects.unshift object
|
|
427
|
+
puts( if objects.length == 1
|
|
428
|
+
YAML::dump( *objects )
|
|
429
|
+
else
|
|
430
|
+
YAML::dump_stream( *objects )
|
|
431
|
+
end )
|
|
432
|
+
end
|
|
433
|
+
private :y
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#
|
|
2
|
+
# BaseEmitter
|
|
3
|
+
#
|
|
4
|
+
|
|
5
|
+
require 'yaml/constants'
|
|
6
|
+
require 'yaml/encoding'
|
|
7
|
+
require 'yaml/error'
|
|
8
|
+
|
|
9
|
+
module YAML
|
|
10
|
+
|
|
11
|
+
module BaseEmitter
|
|
12
|
+
|
|
13
|
+
def options( opt = nil )
|
|
14
|
+
if opt
|
|
15
|
+
@options[opt] || YAML::DEFAULTS[opt]
|
|
16
|
+
else
|
|
17
|
+
@options
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def options=( opt )
|
|
22
|
+
@options = opt
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# Emit binary data
|
|
27
|
+
#
|
|
28
|
+
def binary_base64( value )
|
|
29
|
+
self << "!binary "
|
|
30
|
+
self.node_text( [value].pack("m"), '|' )
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
#
|
|
34
|
+
# Emit plain, normal flowing text
|
|
35
|
+
#
|
|
36
|
+
def node_text( value, block = nil )
|
|
37
|
+
@seq_map = false
|
|
38
|
+
valx = value.dup
|
|
39
|
+
unless block
|
|
40
|
+
block =
|
|
41
|
+
if options(:UseBlock)
|
|
42
|
+
'|'
|
|
43
|
+
elsif not options(:UseFold) and valx =~ /\n[ \t]/ and not valx =~ /#{YAML::ESCAPE_CHAR}/
|
|
44
|
+
'|'
|
|
45
|
+
else
|
|
46
|
+
'>'
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
indt = $&.to_i if block =~ /\d+/
|
|
50
|
+
if valx =~ /(\A\n*[ \t#]|^---\s+)/
|
|
51
|
+
indt = options(:Indent) unless indt.to_i > 0
|
|
52
|
+
block += indt.to_s
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
block +=
|
|
56
|
+
if valx =~ /\n\Z\n/
|
|
57
|
+
"+"
|
|
58
|
+
elsif valx =~ /\Z\n/
|
|
59
|
+
""
|
|
60
|
+
else
|
|
61
|
+
"-"
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
block += "\n"
|
|
65
|
+
if block[0] == ?"
|
|
66
|
+
esc_skip = ( "\t\n" unless valx =~ /^[ \t]/ ) || ""
|
|
67
|
+
valx = fold( YAML::escape( valx, esc_skip ) + "\"" ).chomp
|
|
68
|
+
self << '"' + indent_text( valx, indt, false )
|
|
69
|
+
else
|
|
70
|
+
if block[0] == ?>
|
|
71
|
+
valx = fold( valx )
|
|
72
|
+
end
|
|
73
|
+
#p [block, indt]
|
|
74
|
+
self << block + indent_text( valx, indt )
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#
|
|
79
|
+
# Emit a simple, unqouted string
|
|
80
|
+
#
|
|
81
|
+
def simple( value )
|
|
82
|
+
@seq_map = false
|
|
83
|
+
self << value.to_s
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# Emit double-quoted string
|
|
88
|
+
#
|
|
89
|
+
def double( value )
|
|
90
|
+
"\"#{YAML.escape( value )}\""
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
#
|
|
94
|
+
# Emit single-quoted string
|
|
95
|
+
#
|
|
96
|
+
def single( value )
|
|
97
|
+
"'#{value}'"
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Write a text block with the current indent
|
|
102
|
+
#
|
|
103
|
+
def indent_text( text, mod, first_line = true )
|
|
104
|
+
return "" if text.to_s.empty?
|
|
105
|
+
spacing = indent( mod )
|
|
106
|
+
text = text.gsub( /\A([^\n])/, "#{ spacing }\\1" ) if first_line
|
|
107
|
+
return text.gsub( /\n^([^\n])/, "\n#{spacing}\\1" )
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
#
|
|
111
|
+
# Write a current indent
|
|
112
|
+
#
|
|
113
|
+
def indent( mod = nil )
|
|
114
|
+
#p [ self.id, level, mod, :INDENT ]
|
|
115
|
+
if level <= 0
|
|
116
|
+
mod ||= 0
|
|
117
|
+
else
|
|
118
|
+
mod ||= options(:Indent)
|
|
119
|
+
mod += ( level - 1 ) * options(:Indent)
|
|
120
|
+
end
|
|
121
|
+
return " " * mod
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
#
|
|
125
|
+
# Add indent to the buffer
|
|
126
|
+
#
|
|
127
|
+
def indent!
|
|
128
|
+
self << indent
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
#
|
|
132
|
+
# Folding paragraphs within a column
|
|
133
|
+
#
|
|
134
|
+
def fold( value )
|
|
135
|
+
value.gsub( /(^[ \t]+.*$)|(\S.{0,#{options(:BestWidth) - 1}})(?:[ \t]+|(\n+(?=[ \t]|\Z))|$)/ ) do |s|
|
|
136
|
+
$1 || $2 + ( $3 || "\n" )
|
|
137
|
+
end
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
#
|
|
141
|
+
# Quick mapping
|
|
142
|
+
#
|
|
143
|
+
def map( type, &e )
|
|
144
|
+
val = Mapping.new
|
|
145
|
+
e.call( val )
|
|
146
|
+
self << "#{type} " if type.length.nonzero?
|
|
147
|
+
|
|
148
|
+
#
|
|
149
|
+
# Empty hashes
|
|
150
|
+
#
|
|
151
|
+
if val.length.zero?
|
|
152
|
+
self << "{}"
|
|
153
|
+
@seq_map = false
|
|
154
|
+
else
|
|
155
|
+
# FIXME
|
|
156
|
+
# if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
|
|
157
|
+
# @headless = 1
|
|
158
|
+
# end
|
|
159
|
+
|
|
160
|
+
defkey = @options.delete( :DefaultKey )
|
|
161
|
+
if defkey
|
|
162
|
+
seq_map_shortcut
|
|
163
|
+
self << "= : "
|
|
164
|
+
defkey.to_yaml( :Emitter => self )
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
#
|
|
168
|
+
# Emit the key and value
|
|
169
|
+
#
|
|
170
|
+
val.each { |v|
|
|
171
|
+
seq_map_shortcut
|
|
172
|
+
if v[0].is_complex_yaml?
|
|
173
|
+
self << "? "
|
|
174
|
+
end
|
|
175
|
+
v[0].to_yaml( :Emitter => self )
|
|
176
|
+
if v[0].is_complex_yaml?
|
|
177
|
+
self << "\n"
|
|
178
|
+
indent!
|
|
179
|
+
end
|
|
180
|
+
self << ": "
|
|
181
|
+
v[1].to_yaml( :Emitter => self )
|
|
182
|
+
}
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def seq_map_shortcut
|
|
187
|
+
# FIXME: seq_map needs to work with the new anchoring system
|
|
188
|
+
# if @seq_map
|
|
189
|
+
# @anchor_extras[@buffer.length - 1] = "\n" + indent
|
|
190
|
+
# @seq_map = false
|
|
191
|
+
# else
|
|
192
|
+
self << "\n"
|
|
193
|
+
indent!
|
|
194
|
+
# end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
#
|
|
198
|
+
# Quick sequence
|
|
199
|
+
#
|
|
200
|
+
def seq( type, &e )
|
|
201
|
+
@seq_map = false
|
|
202
|
+
val = Sequence.new
|
|
203
|
+
e.call( val )
|
|
204
|
+
self << "#{type} " if type.length.nonzero?
|
|
205
|
+
|
|
206
|
+
#
|
|
207
|
+
# Empty arrays
|
|
208
|
+
#
|
|
209
|
+
if val.length.zero?
|
|
210
|
+
self << "[]"
|
|
211
|
+
else
|
|
212
|
+
# FIXME
|
|
213
|
+
# if @buffer.length == 1 and options(:UseHeader) == false and type.length.zero?
|
|
214
|
+
# @headless = 1
|
|
215
|
+
# end
|
|
216
|
+
|
|
217
|
+
#
|
|
218
|
+
# Emit the key and value
|
|
219
|
+
#
|
|
220
|
+
val.each { |v|
|
|
221
|
+
self << "\n"
|
|
222
|
+
indent!
|
|
223
|
+
self << "- "
|
|
224
|
+
@seq_map = true if v.class == Hash
|
|
225
|
+
v.to_yaml( :Emitter => self )
|
|
226
|
+
}
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
#
|
|
233
|
+
# Emitter helper classes
|
|
234
|
+
#
|
|
235
|
+
class Mapping < Array
|
|
236
|
+
def add( k, v )
|
|
237
|
+
push [k, v]
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
class Sequence < Array
|
|
242
|
+
def add( v )
|
|
243
|
+
push v
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
end
|