Permalink
Browse files

Revert "Replace klass with described_class"

search/replace was not a good idea.

This reverts commit a4d402f.
  • Loading branch information...
1 parent a4d402f commit b58ab880fab859380f113df0200d13dc788c082e @weppos committed Mar 29, 2013
@@ -64,7 +64,7 @@ class Parser
# # => #<Whois::Record::Parser::Blank>
#
def self.parser_for(part)
- parser_described_class(part.host).new(part)
+ parser_klass(part.host).new(part)
end
# Detects the proper parser class according to given <tt>host</tt>
@@ -84,17 +84,17 @@ def self.parser_for(part)
#
# @example
#
- # Parser.parser_described_class("missing.example.com")
+ # Parser.parser_klass("missing.example.com")
# # => Whois::Record::Parser::Blank
#
# # Define a custom parser for missing.example.com
# class Whois::Record::Parser::MissingExampleCom
# end
#
- # Parser.parser_described_class("missing.example.com")
+ # Parser.parser_klass("missing.example.com")
# # => Whois::Record::Parser::MissingExampleCom
#
- def self.parser_described_class(host)
+ def self.parser_klass(host)
name = host_to_parser(host)
Parser.const_defined?(name) || autoload(host)
Parser.const_get(name)
@@ -7,26 +7,26 @@
let(:record) { Whois::Record.new(nil, []) }
- describe ".parser_described_class" do
+ describe ".parser_klass" do
it "returns the parser hostname converted into a class" do
require 'whois/record/parser/whois.crsnic.net'
- described_class.parser_described_class("whois.crsnic.net").should == Whois::Record::Parser::WhoisCrsnicNet
+ described_class.parser_klass("whois.crsnic.net").should == Whois::Record::Parser::WhoisCrsnicNet
end
it "recognizes and lazy-loads classes" do
- described_class.parser_described_class("whois.nic.it").name.should == "Whois::Record::Parser::WhoisNicIt"
+ described_class.parser_klass("whois.nic.it").name.should == "Whois::Record::Parser::WhoisNicIt"
end
it "recognizes preloaded classes" do
described_class.class_eval <<-RUBY
class PreloadedParserTest
end
RUBY
- described_class.parser_described_class("preloaded.parser.test").name.should == "Whois::Record::Parser::PreloadedParserTest"
+ described_class.parser_klass("preloaded.parser.test").name.should == "Whois::Record::Parser::PreloadedParserTest"
end
it "returns the blank parser if the parser doesn't exist" do
- described_class.parser_described_class("whois.missing.test").name.should == "Whois::Record::Parser::Blank"
+ described_class.parser_klass("whois.missing.test").name.should == "Whois::Record::Parser::Blank"
end
end
@@ -115,8 +115,8 @@
end
it "returns true when other has descendant class and has the same parts" do
- subdescribed_class = Class.new(described_class)
- one, two = described_class.new(server, parts), subdescribed_class.new(server, parts)
+ subklass = Class.new(described_class)
+ one, two = described_class.new(server, parts), subklass.new(server, parts)
(one == two).should be_true
(one.eql? two).should be_true
@@ -3,7 +3,7 @@
describe Whois::Server::Adapters::Arin do
let(:definition) { [:ipv4, "0.0.0.0/1", "whois.arin.net"] }
- let(:server) { described_class.new(*definition) }
+ let(:server) { klass.new(*definition) }
describe "#lookup" do
context "without referral" do
@@ -46,8 +46,8 @@
end
it "returns true when other has descendant class and has the same attributes" do
- subdescribed_class = Class.new(described_class)
- one, two = described_class.new(*definition), subdescribed_class.new(*definition)
+ subklass = Class.new(described_class)
+ one, two = described_class.new(*definition), subklass.new(*definition)
(one == two).should be_true
(one.eql? two).should be_true
View
@@ -67,7 +67,7 @@ end
parts = (source_path.split("/") - SOURCE_PARTS)
khost = parts.first
kfile = parts.last
- described_class = Whois::Record::Parser.parser_described_class(khost)
+ described_class = Whois::Record::Parser.parser_klass(khost)
target_path = File.join(TARGET_DIR, *parts).gsub(".expected", "_spec.rb")

0 comments on commit b58ab88

Please sign in to comment.