mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/yaml/basenode.rb (YAML::BaseNode::match_segment): fix typo.
[ruby-dev:27237], [ruby-core:05854] * lib/yaml/tag.rb (Module#yaml_as): suppress warnings. * lib/yaml/types.rb (YAML::PrivateType, YAML::DomainType): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f307fa8513
commit
7567345876
5 changed files with 63 additions and 41 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Wed Sep 28 07:56:52 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/yaml/basenode.rb (YAML::BaseNode::match_segment): fix typo.
|
||||||
|
[ruby-dev:27237], [ruby-core:05854]
|
||||||
|
|
||||||
|
* lib/yaml/tag.rb (Module#yaml_as): suppress warnings.
|
||||||
|
|
||||||
|
* lib/yaml/types.rb (YAML::PrivateType, YAML::DomainType): ditto.
|
||||||
|
|
||||||
Wed Sep 28 03:23:35 2005 NAKAMURA Usaku <usa@ruby-lang.org>
|
Wed Sep 28 03:23:35 2005 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* rubysig.h: fixed build problem with --enable-pthread on platforms
|
* rubysig.h: fixed build problem with --enable-pthread on platforms
|
||||||
|
|
|
@ -76,6 +76,9 @@ SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *));
|
||||||
void rb_syck_output_handler _((SyckEmitter *, char *, long));
|
void rb_syck_output_handler _((SyckEmitter *, char *, long));
|
||||||
void rb_syck_emitter_handler _((SyckEmitter *, st_data_t));
|
void rb_syck_emitter_handler _((SyckEmitter *, st_data_t));
|
||||||
int syck_parser_assign_io _((SyckParser *, VALUE));
|
int syck_parser_assign_io _((SyckParser *, VALUE));
|
||||||
|
VALUE syck_scalar_alloc _((VALUE class));
|
||||||
|
VALUE syck_seq_alloc _((VALUE class));
|
||||||
|
VALUE syck_map_alloc _((VALUE class));
|
||||||
|
|
||||||
struct parser_xtra {
|
struct parser_xtra {
|
||||||
VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
|
VALUE data; /* Borrowed this idea from marshal.c to fix [ruby-core:8067] problem */
|
||||||
|
|
|
@ -148,7 +148,7 @@ module YAML
|
||||||
if pred
|
if pred
|
||||||
case pred
|
case pred
|
||||||
when /^\.=/
|
when /^\.=/
|
||||||
pred = $'
|
pred = $' # '
|
||||||
match_nodes.reject! { |n|
|
match_nodes.reject! { |n|
|
||||||
n.last.value != pred
|
n.last.value != pred
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ module YAML
|
||||||
v = @value.detect { |k,v| k.transform == key.first }
|
v = @value.detect { |k,v| k.transform == key.first }
|
||||||
v[1] if v
|
v[1] if v
|
||||||
elsif Array === @value
|
elsif Array === @value
|
||||||
@value.[]( *k )
|
@value.[]( *key )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,14 @@ class Module # :nodoc: all
|
||||||
# in YAML. See YAML::tag_class for detailed information on typing and
|
# in YAML. See YAML::tag_class for detailed information on typing and
|
||||||
# taguris.
|
# taguris.
|
||||||
def yaml_as( tag, sc = true )
|
def yaml_as( tag, sc = true )
|
||||||
class_eval <<-"end;"
|
verbose, $VERBOSE = $VERBOSE, nil
|
||||||
attr_accessor :taguri
|
class_eval <<-"end;", __FILE__, __LINE__+1
|
||||||
|
attr_writer :taguri
|
||||||
def taguri
|
def taguri
|
||||||
if respond_to? :to_yaml_type
|
if respond_to? :to_yaml_type
|
||||||
YAML::tagurize( to_yaml_type[1..-1] )
|
YAML::tagurize( to_yaml_type[1..-1] )
|
||||||
else
|
else
|
||||||
return @taguri if @taguri
|
return @taguri if defined?(@taguri) and @taguri
|
||||||
tag = #{ tag.dump }
|
tag = #{ tag.dump }
|
||||||
if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag]
|
if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag]
|
||||||
tag = "\#{ tag }:\#{ self.class.yaml_tag_class_name }"
|
tag = "\#{ tag }:\#{ self.class.yaml_tag_class_name }"
|
||||||
|
@ -72,6 +73,8 @@ class Module # :nodoc: all
|
||||||
def self.yaml_tag_subclasses?; #{ sc ? 'true' : 'false' }; end
|
def self.yaml_tag_subclasses?; #{ sc ? 'true' : 'false' }; end
|
||||||
end;
|
end;
|
||||||
YAML::tag_class tag, self
|
YAML::tag_class tag, self
|
||||||
|
ensure
|
||||||
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
# Transforms the subclass name into a name suitable for display
|
# Transforms the subclass name into a name suitable for display
|
||||||
# in a subclassed tag.
|
# in a subclassed tag.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# -*- mode: ruby; ruby-indent-level: 4 -*- vim: sw=4
|
||||||
#
|
#
|
||||||
# Classes required by the full core typeset
|
# Classes required by the full core typeset
|
||||||
#
|
#
|
||||||
|
@ -10,6 +11,7 @@ module YAML
|
||||||
class PrivateType
|
class PrivateType
|
||||||
def self.tag_subclasses?; false; end
|
def self.tag_subclasses?; false; end
|
||||||
attr_accessor :type_id, :value
|
attr_accessor :type_id, :value
|
||||||
|
verbose, $VERBOSE = $VERBOSE, nil
|
||||||
def initialize( type, val )
|
def initialize( type, val )
|
||||||
@type_id = type; @value = val
|
@type_id = type; @value = val
|
||||||
@value.taguri = "x-private:#{ @type_id }"
|
@value.taguri = "x-private:#{ @type_id }"
|
||||||
|
@ -17,6 +19,8 @@ module YAML
|
||||||
def to_yaml( opts = {} )
|
def to_yaml( opts = {} )
|
||||||
@value.to_yaml( opts )
|
@value.to_yaml( opts )
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -25,6 +29,7 @@ module YAML
|
||||||
class DomainType
|
class DomainType
|
||||||
def self.tag_subclasses?; false; end
|
def self.tag_subclasses?; false; end
|
||||||
attr_accessor :domain, :type_id, :value
|
attr_accessor :domain, :type_id, :value
|
||||||
|
verbose, $VERBOSE = $VERBOSE, nil
|
||||||
def initialize( domain, type, val )
|
def initialize( domain, type, val )
|
||||||
@domain = domain; @type_id = type; @value = val
|
@domain = domain; @type_id = type; @value = val
|
||||||
@value.taguri = "tag:#{ @domain }:#{ @type_id }"
|
@value.taguri = "tag:#{ @domain }:#{ @type_id }"
|
||||||
|
@ -32,6 +37,8 @@ module YAML
|
||||||
def to_yaml( opts = {} )
|
def to_yaml( opts = {} )
|
||||||
@value.to_yaml( opts )
|
@value.to_yaml( opts )
|
||||||
end
|
end
|
||||||
|
ensure
|
||||||
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue