lib/inch/code_object/provider/yard/object/base.rb in inch-0.4.6 vs lib/inch/code_object/provider/yard/object/base.rb in inch-0.4.7

- old
+ new

@@ -1,6 +1,6 @@ -require 'forwardable' +require "forwardable" module Inch module CodeObject module Provider module YARD @@ -19,11 +19,13 @@ # Tags considered by wrapper methods like {#has_code_example?} CONSIDERED_YARD_TAGS = %w(api example param private return since) AUTO_GENERATED_TAG_NAMES = %w(raise yield) # convenient shortcuts to (YARD) code object - def_delegators :object, :type, :namespace, :source, :source_type, :group, :dynamic, :visibility + def_delegators :object, + :type, :namespace, :source, :source_type, :group, + :dynamic, :visibility # @param object [YARD::CodeObjects::Base] the actual (YARD) code object def initialize(object) @object = object @__api_tag = __api_tag @@ -65,12 +67,33 @@ # @see Proxy::NamespaceObject def children [] end - RUBY_CORE = %w(Array Bignum BasicObject Object Module Class Complex NilClass Numeric String Float Fiber FiberError Continuation Dir File Encoding Enumerator StopIteration Enumerator::Generator Enumerator::Yielder Exception SystemExit SignalException Interrupt StandardError TypeError ArgumentError IndexError KeyError RangeError ScriptError SyntaxError LoadError NotImplementedError NameError NoMethodError RuntimeError SecurityError NoMemoryError EncodingError SystemCallError Encoding::CompatibilityError File::Stat IO Hash ENV IOError EOFError ARGF RubyVM RubyVM::InstructionSequence Math::DomainError ZeroDivisionError FloatDomainError Integer Fixnum Data TrueClass FalseClass Mutex Thread Proc LocalJumpError SystemStackError Method UnboundMethod Binding Process::Status Random Range Rational RegexpError Regexp MatchData Symbol Struct ThreadGroup ThreadError Time Encoding::UndefinedConversionError Encoding::InvalidByteSequenceError Encoding::ConverterNotFoundError Encoding::Converter RubyVM::Env) + - %w(Comparable Kernel File::Constants Enumerable Errno FileTest GC ObjectSpace GC::Profiler IO::WaitReadable IO::WaitWritable Marshal Math Process Process::UID Process::GID Process::Sys Signal) + RUBY_CORE = %w( + Array Bignum BasicObject Object Module Class Complex NilClass + Numeric String Float Fiber FiberError Continuation Dir File + Encoding Enumerator StopIteration Enumerator::Generator + Enumerator::Yielder Exception SystemExit SignalException Interrupt + StandardError TypeError ArgumentError IndexError KeyError + RangeError ScriptError SyntaxError LoadError NotImplementedError + NameError NoMethodError RuntimeError SecurityError NoMemoryError + EncodingError SystemCallError Encoding::CompatibilityError + File::Stat IO Hash ENV IOError EOFError ARGF RubyVM + RubyVM::InstructionSequence Math::DomainError ZeroDivisionError + FloatDomainError Integer Fixnum Data TrueClass FalseClass Mutex + Thread Proc LocalJumpError SystemStackError Method UnboundMethod + Binding Process::Status Random Range Rational RegexpError Regexp + MatchData Symbol Struct ThreadGroup ThreadError Time + Encoding::UndefinedConversionError + Encoding::InvalidByteSequenceError + Encoding::ConverterNotFoundError Encoding::Converter RubyVM::Env + + Comparable Kernel File::Constants Enumerable Errno FileTest GC + ObjectSpace GC::Profiler IO::WaitReadable IO::WaitWritable Marshal + Math Process Process::UID Process::GID Process::Sys Signal + ) def core? RUBY_CORE.include?(name.to_s) end # @return [Docstring] @@ -90,11 +113,12 @@ # this error is raised by YARD # see broken.rb in test fixtures [] end - # CodeLocation is a utility class to find declarations of objects in files + # CodeLocation is a utility class to find declarations of objects in + # files class CodeLocation < Struct.new(:base_dir, :relative_path, :line_no) def filename File.join(base_dir, relative_path) end end @@ -226,11 +250,11 @@ def unconsidered_tag_count unconsidered_tags.size end def inspect - "#<#{self.class.to_s}: #{fullname}>" + "#<#{self.class}: #{fullname}>" end protected def multi_code_examples?(text) @@ -246,11 +270,11 @@ def private_tag @__private_tag end def private_api_tag? - api_tag && api_tag.text == 'private' + api_tag && api_tag.text == "private" end def tag(name) tags(name).first end @@ -267,15 +291,15 @@ # YARD tags that are not already covered by other wrapper methods def unconsidered_tags @unconsidered_tags ||= tags.reject do |tag| auto_generated_tag?(tag) || CONSIDERED_YARD_TAGS.include?(tag.tag_name) - end + end end def __depth(i = 0) if parent - parent.__depth(i+1) + parent.__depth(i + 1) else i end end