mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/prime.rb (EratosthenesGenerator#initialize): call super.
(TrialDivisionGenerator, Generator23): ditto. [ruby-core:25539] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24884 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
63b231cea0
commit
a8998030fb
2 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sun Sep 13 09:38:06 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/prime.rb (EratosthenesGenerator#initialize): call super.
|
||||||
|
(TrialDivisionGenerator, Generator23): ditto. [ruby-core:25539]
|
||||||
|
|
||||||
Sun Sep 13 09:34:10 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Sep 13 09:34:10 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* vm_method.c (rb_add_method_def): no warning for inherited
|
* vm_method.c (rb_add_method_def): no warning for inherited
|
||||||
|
|
|
@ -91,14 +91,14 @@ class Prime
|
||||||
warn "Prime::new is obsolete. use Prime::instance or class methods of Prime."
|
warn "Prime::new is obsolete. use Prime::instance or class methods of Prime."
|
||||||
end
|
end
|
||||||
|
|
||||||
class<<self
|
class << self
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
include Enumerable
|
include Enumerable
|
||||||
# Returns the default instance of Prime.
|
# Returns the default instance of Prime.
|
||||||
def instance; @the_instance end
|
def instance; @the_instance end
|
||||||
|
|
||||||
def method_added(method) # :nodoc:
|
def method_added(method) # :nodoc:
|
||||||
(class<<self;self;end).def_delegator :instance, method
|
(class<< self;self;end).def_delegator :instance, method
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -290,6 +290,7 @@ class Prime
|
||||||
class EratosthenesGenerator < PseudoPrimeGenerator
|
class EratosthenesGenerator < PseudoPrimeGenerator
|
||||||
def initialize
|
def initialize
|
||||||
@last_prime = nil
|
@last_prime = nil
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def succ
|
def succ
|
||||||
|
@ -306,6 +307,7 @@ class Prime
|
||||||
class TrialDivisionGenerator<PseudoPrimeGenerator
|
class TrialDivisionGenerator<PseudoPrimeGenerator
|
||||||
def initialize
|
def initialize
|
||||||
@index = -1
|
@index = -1
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def succ
|
def succ
|
||||||
|
@ -327,6 +329,7 @@ class Prime
|
||||||
def initialize
|
def initialize
|
||||||
@prime = 1
|
@prime = 1
|
||||||
@step = nil
|
@step = nil
|
||||||
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def succ
|
def succ
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue