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/trunk@9323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
63e5821460
commit
462fd870d7
5 changed files with 63 additions and 41 deletions
|
@ -55,13 +55,14 @@ class Module # :nodoc: all
|
|||
# in YAML. See YAML::tag_class for detailed information on typing and
|
||||
# taguris.
|
||||
def yaml_as( tag, sc = true )
|
||||
class_eval <<-"end;"
|
||||
attr_accessor :taguri
|
||||
verbose, $VERBOSE = $VERBOSE, nil
|
||||
class_eval <<-"end;", __FILE__, __LINE__+1
|
||||
attr_writer :taguri
|
||||
def taguri
|
||||
if respond_to? :to_yaml_type
|
||||
YAML::tagurize( to_yaml_type[1..-1] )
|
||||
else
|
||||
return @taguri if @taguri
|
||||
return @taguri if defined?(@taguri) and @taguri
|
||||
tag = #{ tag.dump }
|
||||
if self.class.yaml_tag_subclasses? and self.class != YAML::tagged_classes[tag]
|
||||
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
|
||||
end;
|
||||
YAML::tag_class tag, self
|
||||
ensure
|
||||
$VERBOSE = verbose
|
||||
end
|
||||
# Transforms the subclass name into a name suitable for display
|
||||
# in a subclassed tag.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue