lib/inch/code_object/proxy/base.rb in inch-0.1.3 vs lib/inch/code_object/proxy/base.rb in inch-0.1.4
- old
+ new
@@ -1,10 +1,11 @@
require 'forwardable'
module Inch
module CodeObject
module Proxy
+ # @abstract
class Base
extend Forwardable
include NodocHelper
# the actual (YARD) code object
@@ -111,32 +112,10 @@
else
i
end
end
- # In the following example, the height of +Foo+ is 3
- # (the height of the top-level is 4):
- #
- # Foo::Bar::Baz#initialize
- # ^ ^ ^ ^
- # 0 >> 1 >> 2 >> 3
- #
- # +height+ answers the question "how many layers of code objects are
- # underneath this one?"
- #
- # @param i [Fixnum] a counter for recursive method calls
- # @return [Fixnum] the height of the object in terms of namespace
- def height(i = 0)
- if children && !children.empty?
- children.map do |child|
- child.height(i+1)
- end.max
- else
- i
- end
- end
-
# @return [Boolean] +true+ if the object represents a method
def method?
false
end
@@ -184,10 +163,10 @@
end
private
def multi_code_examples?(text)
- text =~ /\b#{Regexp.escape(name)}[^_0-9\!\?]/
+ text.scan(/\b(#{Regexp.escape(name)})[^_0-9\!\?]/m).size > 1
end
end
end
end
end