Sha256: 70aa13be1622830e57fc512aeb1bbb8438add189ca2554337ca5a20d20b1e5ce

Contents?: true

Size: 726 Bytes

Versions: 7

Compression:

Stored size: 726 Bytes

Contents

# 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|
        case node.type
        when :symbol; source = node.first.source
        when :string_content; source = node.source
        else next
        end
        MethodObject.new(namespace, source, scope) {|o| o.visibility = ident.first }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
yard-0.6.8 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.7 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.6 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.5 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.4 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.3 lib/yard/handlers/ruby/visibility_handler.rb
yard-0.6.2 lib/yard/handlers/ruby/visibility_handler.rb