Skip to content

Commit

Permalink
Fix code formatting to mat my style more closely
Browse files Browse the repository at this point in the history
  • Loading branch information
dkubb committed Nov 25, 2012
1 parent 870c251 commit 0751d37
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions lib/abstract_class.rb
Expand Up @@ -11,7 +11,6 @@ module AbstractClass
# @return [self]
#
# @api private
#
def self.included(descendant)
super
descendant.extend(ClassMethods)
Expand All @@ -31,7 +30,6 @@ module ClassMethods
# @return [Object]
#
# @api public
#
def new(*)
if superclass.equal?(Object)
raise NotImplementedError, "#{self} is an abstract class"
Expand All @@ -54,12 +52,8 @@ def new(*)
# end
#
# @api public
#
def abstract_method(*names)
names.each do |name|
create_abstract_instance_method(name)
end

names.each { |name| create_abstract_instance_method(name) }
self
end

Expand All @@ -75,12 +69,8 @@ def abstract_method(*names)
# @return [self]
#
# @api private
#
def abstract_singleton_method(*names)
names.each do |name|
create_abstract_singleton_method(name)
end

names.each { |name| create_abstract_singleton_method(name) }
self
end

Expand All @@ -94,12 +84,11 @@ def abstract_singleton_method(*names)
# @return [undefined]
#
# @api private
#
def create_abstract_singleton_method(name)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def self.#{name}(*)
raise NotImplementedError, "\#{name}.\#{__method__} is not implemented"
end
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def self.#{name}(*) # def self.name(*)
raise NotImplementedError, "\#{name}.\#{__method__} is not implemented" # raise NotImplementedError, 'MyClass#name is not implemented'
end # end
RUBY
end

Expand All @@ -111,12 +100,11 @@ def self.#{name}(*)
# @return [undefined]
#
# @api private
#
def create_abstract_instance_method(name)
class_eval(<<-RUBY, __FILE__, __LINE__+1)
def #{name}(*)
raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented"
end
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}(*) # def name(*)
raise NotImplementedError, "\#{self.class.name}#\#{__method__} is not implemented" # raise NotImplementedError, 'MyClass.name is not implemented'
end # end
RUBY
end

Expand Down

0 comments on commit 0751d37

Please sign in to comment.