lib/yard/code_objects/method_object.rb in yard-0.5.8 vs lib/yard/code_objects/method_object.rb in yard-0.6.0
- old
+ new
@@ -59,21 +59,24 @@
end
# Returns the read/writer info for the attribute if it is one
# @return [SymbolHash] if there is information about the attribute
# @return [nil] if the method is not an attribute
+ # @since 0.5.3
def attr_info
return nil unless namespace.is_a?(NamespaceObject)
namespace.attributes[scope][name.to_s.gsub(/=$/, '')]
end
# @return [Boolean] whether the method is a writer attribute
+ # @since 0.5.3
def writer?
!!((info = attr_info) && info[:write] == self)
end
# @return [Boolean] whether the method is a reader attribute
+ # @since 0.5.3
def reader?
!!((info = attr_info) && info[:read] == self)
end
# Tests if the object is defined as an attribute in the namespace
@@ -93,9 +96,17 @@
# Tests boolean {#explicit} value.
#
# @return [Boolean] whether the method is explicitly defined in source
def is_explicit?
explicit ? true : false
+ end
+
+ # @return [MethodObject] the object that this method overrides
+ # @return [nil] if it does not override a method
+ # @since 0.6.0
+ def overridden_method
+ meths = namespace.meths(:all => true)
+ meths.find {|m| m.path != path && m.name == name && m.scope == scope }
end
# Returns all alias names of the object
# @return [Array<Symbol>] the alias names
def aliases