subclasses of Array do not inherit instance variables via member functions
--------------------------------------------------------------------------

                 Key: JRUBY-5704
                 URL: http://jira.codehaus.org/browse/JRUBY-5704
             Project: JRuby
          Issue Type: Bug
            Reporter: Aman Gupta
            Assignee: Thomas E Enebo


this repro code is based on the WillPaginate::Collection rails plugin. the 
instance returned from #compact does not contain instance variables like it 
does on the other ruby implementations.

{noformat}
$ cat wptest.rb
class Collection < Array
  attr_reader :current_page

  def initialize(page=1)
    @current_page = page.to_i
  end
end

c = Collection.new(2)
c.replace([1,2,3])
c = c.compact
p [c.class, c.current_page]
{noformat}

{noformat}
$ ruby -v wptest.rb
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
[Collection, 2]
{noformat}

{noformat}
$ ruby -v wptest.rb
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.6.0]
[Collection, 2]
{noformat}

{noformat}
$ rbx -v wptest.rb
rubinius 1.2.4dev (1.8.7 e906a2ef yyyy-mm-dd JI) [x86_64-apple-darwin10.6.0]
[Collection, 2]
{noformat}

{noformat}
$ jruby -v wptest.rb
jruby 1.6.0 (ruby-1.8.7-p330) (2011-04-06 aa7d946) (Java HotSpot(TM) 64-Bit 
Server VM 1.6.0_24) [darwin-x86_64-java]
[Collection, nil]
{noformat}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to