summaryrefslogtreecommitdiff
path: root/lib/set.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-02 16:45:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-02 16:45:35 +0000
commit29cef5f795043a048a58874d90de0dfe01aa12ea (patch)
tree6ae42a518c1c5705b8f097668d2b83413da0b6ec /lib/set.rb
parent8815306dc5aadd777c887bbd8de7057598ad709c (diff)
downloadbundler-29cef5f795043a048a58874d90de0dfe01aa12ea.tar.gz
use Object#class instead of deprecated Object#type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/set.rb')
-rw-r--r--lib/set.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/set.rb b/lib/set.rb
index 04c7b101fa..945bdd7c98 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -226,7 +226,7 @@ class Set
def dup
myhash = @hash
- type.new.instance_eval {
+ self.class.new.instance_eval {
@hash.replace(myhash)
self
}
@@ -247,7 +247,7 @@ class Set
end
def replace(enum)
- if enum.type == type
+ if enum.class == self.class
@hash.replace(enum.instance_eval { @hash })
else
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
@@ -282,7 +282,7 @@ class Set
protected :flatten_merge
def flatten
- type.new.flatten_merge(self)
+ self.class.new.flatten_merge(self)
end
def flatten!
@@ -340,7 +340,7 @@ class Set
end
def collect!
- set = type.new
+ set = self.class.new
each { |o| set << yield(o) }
replace(set)
end
@@ -353,7 +353,7 @@ class Set
end
def merge(enum)
- if enum.type == type
+ if enum.class == self.class
@hash.update(enum.instance_eval { @hash })
else
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
@@ -382,7 +382,7 @@ class Set
def &(enum)
enum.is_a?(Enumerable) or raise ArgumentError, "value must be enumerable"
- n = type.new
+ n = self.class.new
enum.each { |o| include?(o) and n.add(o) }
n
end
@@ -415,7 +415,7 @@ class Set
each { |i|
x = yield(i)
- (h[x] ||= type.new).add(i)
+ (h[x] ||= self.class.new).add(i)
}
h
@@ -441,7 +441,7 @@ class Set
set = Set.new()
dig.each_strongly_connected_component { |css|
- set.add(type.new(css))
+ set.add(self.class.new(css))
}
set
else
@@ -455,19 +455,19 @@ class Set
ids = (Thread.current[InspectKey] ||= [])
if ids.include?(id)
- return sprintf('#<%s: {...}>', type.name)
+ return sprintf('#<%s: {...}>', self.class.name)
end
begin
ids << id
- return sprintf('#<%s: {%s}>', type, to_a.inspect[1..-2])
+ return sprintf('#<%s: {%s}>', self.class, to_a.inspect[1..-2])
ensure
ids.pop
end
end
def pretty_print(pp)
- pp.text sprintf('#<%s: {', type.name)
+ pp.text sprintf('#<%s: {', self.class.name)
pp.nest(1) {
first = true
each { |o|
@@ -484,7 +484,7 @@ class Set
end
def pretty_print_cycle(pp)
- pp.text sprintf('#<%s: {%s}>', type.name, empty? ? '' : '...')
+ pp.text sprintf('#<%s: {%s}>', self.class.name, empty? ? '' : '...')
end
end