Changeset 230 for trunk/ext

Show
Ignore:
Timestamp:
09/21/2005 22:50:44 (3 years ago)
Author:
why
Message:

lib/yaml/basenode.rb: fix array index in BaseNode?#[].
lib/yaml/types.rb: warnings coming from PrivateType? and DomainType?.

Location:
trunk/ext/ruby
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/ext/ruby/lib/yaml/basenode.rb

    r224 r230  
    188188                v[1] if v 
    189189            elsif Array === @value 
    190                 @value.[]( *k ) 
     190                @value.[]( *key ) 
    191191            end 
    192192        end 
  • trunk/ext/ruby/lib/yaml/types.rb

    r216 r230  
    1111        class PrivateType 
    1212        def self.tag_subclasses?; false; end 
    13                 attr_accessor :type_id, :value 
    14                 def initialize( type, val ) 
    15                         @type_id = type; @value = val 
     13        old_init = instance_method(:initialize) 
     14        define_method(:initialize) do |*args| 
     15            old_init.call(*args) 
    1616            @value.taguri = "x-private:#{ @type_id }" 
    1717                end 
     
    2727        def self.tag_subclasses?; false; end 
    2828                attr_accessor :domain, :type_id, :value 
    29                 def initialize( domain, type, val ) 
    30                         @domain = domain; @type_id = type; @value = val 
     29        old_init = instance_method(:initialize) 
     30        define_method(:initialize) do |*args| 
     31            old_init.call(*args) 
    3132            @value.taguri = "tag:#{ @domain }:#{ @type_id }" 
    3233                end 
  • trunk/ext/ruby/tests/basic.rb

    r227 r230  
    3535    # 
    3636    def assert_bytecode( obj, yaml ) 
    37         yp = YAML::Syck::Parser.new 
     37        yp = YAML::Parser.new 
    3838        yp.input = :bytecode 
    3939        assert_equal( obj, yp.load( yaml ) ) 
     
    4646                assert_equal( obj, YAML::load( yaml ) ) 
    4747        assert_equal( obj, YAML::parse( yaml ).transform ) 
    48         yp = YAML::Syck::Parser.new 
     48        yp = YAML::Parser.new 
    4949        yp.input = :bytecode 
    5050        assert_equal( obj, yp.load( YAML::Syck::compile( yaml ) ) ) 
     
    976976 
    977977        doc_ct = 0 
    978         yp = YAML::Syck::Parser.new 
    979         yp.resolver = YAML.resolver 
     978        yp = YAML::Parser.new 
    980979        yp.input = :bytecode 
    981980        yp.load_documents(