Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Jan 3, 2015
  1. @jballanc
Commits on Jul 5, 2013
  1. @Watson1978

    fix a bug in Array() where it will return incorrected value if passed…

    Watson1978 authored
    … NSArray as argument
    
    ary = [1, 2, 3] * 20
    nsary = NSArray.arrayWithArray(ary)
    
    p nsary.size        #=> 60
    p Array(nsary).size #=> Expected 60, but incorrected value returns
Commits on Jun 20, 2013
  1. @Watson1978

    loop unrolling to improve the Objective-C methods performance in Stri…

    Watson1978 authored
    …ng object
    
    * before
          user     system      total        real
      2.310000   0.320000   2.630000 (  3.078306)
    
    * after
          user     system      total        real
      1.560000   0.230000   1.790000 (  2.309584)
    
    Test Code:
    ----
    framework 'Foundation'
    require 'benchmark'
    
    Benchmark.bm do |x|
      str = "abc" * 100000000
      x.report do
        str.writeToFile("test.txt", atomically:true, encoding:NSUTF8StringEncoding, error:nil)
      end
    end
  2. @Watson1978

    refactor

    Watson1978 authored
Commits on Jun 17, 2013
  1. @Watson1978

    fix a bug in defined?(super) which returns the incorrect value if use…

    Watson1978 authored
    … in included module
    
    Test Code:
    ----
    module Stuff
      def foo
        puts "In Stuff#foo"
        if defined?(super)
          puts "Calling super"
          super
        else
          puts "No super"
        end
      end
    end
    
    module OtherStuff
      def foo
        puts "In OtherStuff#foo"
        p defined?(super)
      end
    end
    
    class NoSuper
      include Stuff
    end
    NoSuper.new.foo
    
    class WithSuper
      include OtherStuff
      include Stuff
    end
    WithSuper.new.foo
    
    Result
    ----
    $ macruby t.rb
    In Stuff#foo
    Calling super
    /Volumes/Mac/Users/watson/tmp/t.rb:6:in `foo': super: no superclass method `foo' for #<NoSuper:0x4001a33a0> (NoMethodError)
    	from /Volumes/Mac/Users/watson/tmp/t.rb:23:in `<main>'
    
    Expected
    ----
    $ ruby t.rb
    In Stuff#foo
    No super
    In Stuff#foo
    Calling super
    In OtherStuff#foo
    nil
Commits on Jun 10, 2013
  1. @Watson1978

    improve the performance of string interpolation

    Watson1978 authored
    This patch will reduce the count of reallocation.
    
    * before
          user     system      total        real
     10.900000   0.280000  11.180000 (  9.054008)
    
     * after
         user     system      total        real
     8.880000   0.230000   9.110000 (  7.260528)
    
    Test Code:
    ----
    require 'benchmark'
    
    Benchmark.bm do |x|
      part = "a" * 10
    
      x.report do
        1000000.times do
          "#{part} #{part} #{part} #{part} #{part} #{part} #{part}"
        end
      end
    end
Commits on May 19, 2013
  1. @Watson1978

    update spec's tag

    Watson1978 authored
  2. @Watson1978

    fix a bug in Module#remove_method which it could call undefined metho…

    Watson1978 authored
    …d if call it once
    
    Test Code:
    ----
    class Foo
      def meth
      end
    end
    
    obj = Foo.new
    obj.meth
    
    class Foo
      remove_method :meth
    end
    p obj.meth
    
    Result:
    ----
    $ macruby test_remove.rb
    nil
    
    Expected:
    ----
    $ ruby test_remove.rb
    test_remove.rb:12:in `<main>': undefined method `meth' for #<Foo:0x007fad558b9cc8> (NoMethodError)
  3. @Watson1978

    fix a bug in `undef' which it could call undefined method if call it …

    Watson1978 authored
    …once
    
    Test Code:
    ----
    class Foo
      def meth
      end
    end
    
    obj = Foo.new
    obj.meth
    
    class Foo
      undef meth
    end
    p obj.meth
    
    Result:
    ----
    $ macruby test_undef.rb
    nil
    
    Expected:
    ----
    ruby test_undef.rb
    test_undef.rb:12:in `<main>': undefined method `meth' for #<Foo:0x007f8231935d18> (NoMethodError)
  4. @Watson1978
  5. @Watson1978

    update spec's tag

    Watson1978 authored
  6. @Watson1978

    fix a bug in {Proc, Symbol}#allocate where it would be triggered the …

    Watson1978 authored
    …crash
    
    Result:
    $ macirb
    irb(main):001:0> Proc.allocate
    zsh: segmentation fault  macirb
    
    Expected:
    $ irb
    irb(main):001:0> Proc.allocate
    TypeError: allocator undefined for ProcExpected:
Commits on Apr 25, 2013
  1. @Watson1978
Commits on Apr 24, 2013
  1. @Watson1978

    enable IO specs

    Watson1978 authored
  2. @Watson1978

    update rubyspec's tags

    Watson1978 authored
Commits on Apr 23, 2013
  1. @Watson1978

    add BasicObject#__id__

    Watson1978 authored
Commits on Apr 21, 2013
  1. @Watson1978
Commits on Apr 17, 2013
  1. @Watson1978
  2. @Watson1978
Commits on Apr 13, 2013
  1. @Watson1978

    [fix #208] fix a bug where set a constant which it will not raise an …

    Watson1978 authored
    …exception if it contains Fixnum in namaspec
    
    Result:
    $  macruby -e 'p 7::C = 42'
    42
    $ macruby -e 'A = 7; p A::C = 42'
    42
    
    Expect:
    $ ruby -e 'p 7::C = 42'
    -e:1:in `<main>': 7 is not a class/module (TypeError)
    $ ruby -e 'A = 7; p A::C = 42'
    -e:1:in `<main>': 7 is not a class/module (TypeError)
Commits on Apr 6, 2013
  1. @Watson1978

    add rubyspec's tags

    Watson1978 authored
  2. @Watson1978
  3. @Watson1978
  4. @Watson1978

    update rubyspec's tags

    Watson1978 authored
Commits on Apr 4, 2013
  1. @Watson1978

    [fix #203] fix a bug in super which fails to look up method in method…

    Watson1978 authored
    … which called by super
    
    The 'super' saves the calling status (caller class, selector, etc).
    At twice 'super' calling, look up wrong class.
    
    The following sequence had executed.
    
    - Base (Super class)
    - Foo (Inherited Base)
    
    1. Foo#bar -- super --> look up super class of Foo (Base)
    2. Foo#bar -- super --> look up super class of Base
    
    ----
    
    class Base
      def bar(args)
        $result << args.first
        if args = args[1..-1]
          obj = Foo.new
          obj.bar(args)
        end
      end
    end
    
    class Foo < Base
      def bar(args)
        $result << "a"
        super
      end
    end
    
    $result = []
    obj = Foo.new
    obj.bar(%w{1 2 3})
    p $result
Commits on Mar 10, 2013
  1. @Watson1978

    fix a bug in respond_to_key which cannot generate a unique key for di…

    Watson1978 authored
    …fferent klass and sel
    
    The same key is generated in the following two cases.
    
    1. klass = 0xfd085b0
        sel = 0xfd3cf90
        (0xfd085b0 + 0xfd3cf90  -> 0x1FA45540)
    
    2. klass = 0xfd085d0
        sel = 0xfd3cf70
        (0xfd085d0 + 0xfd3cf70 -> 0x1FA45540)
    
      => generated key = 1068693925
    
    Object#respond_to? is not working as expected, because the keys that are not unique.
Commits on Feb 22, 2013
  1. @Watson1978

    Merge pull request #189 from eitoball/encode_to_binary_before_writing…

    Watson1978 authored
    …_with_ssl_socket
    
    Encode to binary before writing with OpenSSL::SSL::SSLSocket
  2. @eitoball
Commits on Feb 21, 2013
  1. @eitoball
Commits on Feb 20, 2013
  1. @Watson1978

    add NSData#to_s

    Watson1978 authored
Commits on Feb 17, 2013
  1. @Watson1978

    use __clang__ instead of __GNUC__

    Watson1978 authored
    because clang has __GNUC__ macro
Commits on Feb 15, 2013
  1. @Watson1978

    Merge pull request #187 from eitoball/change_openssl_hmac_digest_enco…

    Watson1978 authored
    …ding_to_binary
    
    Change encoding of OpenSSL::HMAC.digest result to binary
Commits on Feb 12, 2013
  1. @eitoball
Commits on Feb 8, 2013
  1. @Watson1978
Commits on Jan 26, 2013
  1. @Watson1978

    improve a performance in Array#hash

    Watson1978 authored
    * before
          user     system      total        real
      1.350000   0.010000   1.360000 (  1.356039)
    
    * after
          user     system      total        real
      0.800000   0.000000   0.800000 (  0.806837)
    
    Test Code
    ----
    Benchmark.bm do |x|
      ary = ["a", "b", "c"] * 10000
    
      x.report do
        1000.times do
          ary.hash
        end
      end
    end
Something went wrong with that request. Please try again.