lib/inch/code_object/proxy/base.rb in inch-0.3.3 vs lib/inch/code_object/proxy/base.rb in inch-0.3.4.rc1

- old
+ new

@@ -1,15 +1,19 @@ require 'forwardable' module Inch module CodeObject module Proxy + # This is the base class for code object proxies. + # Code object proxies are via an attributes Hash and provide all methods + # necessary for the evaluation of its documentation. + # # @abstract class Base extend Forwardable - # @return [Symbol] + # @return [Grade] # when objects are assigned to GradeLists, this grade is set to # enable easier querying for objects of a certain grade attr_writer :grade # @return [#find] @@ -41,10 +45,20 @@ @grade ||= Evaluation.new_grade_lists.detect { |range| range.scores.include?(score) }.grade end + # @return [Boolean] if the current object is an alias for something else + def alias? + !aliased_object.nil? + end + + # @return [CodeObject::Proxy::Base] the object the current object is an alias of + def aliased_object + object_lookup.find( self[:aliased_object_fullname] ) + end + # @return [Boolean] +true+ if the object has an @api tag def api_tag? self[:api_tag?] end @@ -59,11 +73,11 @@ def constant? self[:constant?] end def core? - self[:api_tag?] + self[:core?] end # The depth of the following is 4: # # Foo::Bar::Baz#initialize @@ -108,11 +122,11 @@ def fullname self[:fullname] end def has_alias? - self[:has_alias?] + !self[:aliases_fullnames].empty? end def has_children? self[:has_children?] end @@ -150,10 +164,10 @@ # @return [Boolean] +true+ if the object was tagged not to be documented def nodoc? self[:nodoc?] end - # @return [Array,nil] the parent of the current object or +nil+ + # @return [CodeObject::Proxy::Base,nil] the parent of the current object or +nil+ def parent object_lookup.find( self[:parent_fullname] ) end def private?