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

- old
+ new

@@ -23,16 +23,17 @@ # convenient shortcuts to (YARD) code object def_delegators :object, :type, :namespace, :source, :source_type, :group, :dynamic, :visibility - # @param object [YARD::CodeObjects::Base] the actual (YARD) code object + # @param object [YARD::CodeObjects::Base] the actual (YARD) code + # object def initialize(object) @object = object - @__api_tag = __api_tag - @__parent = __parent - @__private_tag = __private_tag + @api_tag = __api_tag + @parent = __parent + @private_tag = __private_tag end # Returns the fullname of the object that the current object # is an alias for attr_accessor :aliased_object_fullname @@ -45,22 +46,22 @@ def api_tag? !api_tag.nil? end - def api_tag - @__api_tag - end + attr_reader :api_tag # To be overridden # @see Proxy::NamespaceObject - # @return [CodeObject::Proxy::Base,nil] the child inside the current object or +nil+ - def child(name) + # @return [CodeObject::Proxy::Base,nil] the child inside the current + # object or +nil+ + def child(_name) nil end - # @return [Array,nil] the full names of the children of the current object + # @return [Array,nil] the full names of the children of the current + # object def children_fullnames [] end # To be overridden @@ -154,13 +155,13 @@ def has_multiple_code_examples? if tags(:example).size > 1 || docstring.code_examples.size > 1 true else - if tag = tag(:example) + if (tag = tag(:example)) multi_code_examples?(tag.text) - elsif text = docstring.code_examples.first + elsif (text = docstring.code_examples.first) multi_code_examples?(text) else false end end @@ -208,13 +209,11 @@ def parameters [] end # @return [Array,nil] the parent of the current object or +nil+ - def parent - @__parent - end + attr_reader :parent def __parent YARD::Object.for(object.parent) if object.parent end @@ -265,12 +264,10 @@ # +true+ if the object or its parent is tagged as @private def private_tag? !private_tag.nil? end - def private_tag - @__private_tag - end + attr_reader :private_tag def private_api_tag? api_tag && api_tag.text == "private" end