lib/yard/handlers/ruby/visibility_handler.rb in yard-0.5.8 vs lib/yard/handlers/ruby/visibility_handler.rb in yard-0.6.0
- old
+ new
@@ -1,18 +1,24 @@
+# Handles 'private', 'protected', and 'public' calls.
class YARD::Handlers::Ruby::VisibilityHandler < YARD::Handlers::Ruby::Base
handles method_call(:private)
handles method_call(:protected)
handles method_call(:public)
+ namespace_only
process do
return if (ident = statement.jump(:ident)) == statement
case statement.type
when :var_ref
self.visibility = ident.first
when :fcall, :command
statement[1].traverse do |node|
- next unless node.type == :ident || node.type == :string_content
- MethodObject.new(namespace, node.source, scope) {|o| o.visibility = ident.first }
+ case node.type
+ when :symbol; source = node.jump(:ident).last
+ when :string_content; source = node.source
+ else next
+ end
+ MethodObject.new(namespace, source, scope) {|o| o.visibility = ident.first }
end
end
end
end
\ No newline at end of file