Sha256: b862267a9a6df6f610e582683f42f9d86fdad7ca897ecefd21d141a49b4b1403

Contents?: true

Size: 723 Bytes

Versions: 5

Compression:

Stored size: 723 Bytes

Contents

class YARD::Handlers::Ruby::Legacy::MixinHandler < YARD::Handlers::Ruby::Legacy::Base
  handles /\Ainclude(\s|\()/
  
  process do
    statement.tokens[1..-1].to_s.split(/\s*,\s*/).each do |mixin|
      process_mixin(mixin.strip)
    end
  end

  private

  def process_mixin(mixin)
    unless mixmatch = mixin[/\A(#{NAMESPACEMATCH})/, 1]
      raise YARD::Parser::UndocumentableError, "mixin #{mixin} for class #{namespace.path}"
    end

    obj = Proxy.new(namespace, mixmatch)
    
    case obj
    when Proxy
      obj.type = :module
    when ConstantObject # If a constant is included, use its value as the real object
      obj = Proxy.new(namespace, obj.value)
    end

    namespace.mixins(scope) << obj
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
yard-0.5.8 lib/yard/handlers/ruby/legacy/mixin_handler.rb
yard-0.5.7 lib/yard/handlers/ruby/legacy/mixin_handler.rb
yard-0.5.6 lib/yard/handlers/ruby/legacy/mixin_handler.rb
yard-0.5.5 lib/yard/handlers/ruby/legacy/mixin_handler.rb
yard-0.5.4 lib/yard/handlers/ruby/legacy/mixin_handler.rb