Sha256: 3faadc6f6aca94252c71d5b66c493a5de5d55c48b7a00ddb148a90ada1538e30

Contents?: true

Size: 984 Bytes

Versions: 39

Compression:

Stored size: 984 Bytes

Contents

class NanocIdentifierHandler < ::YARD::Handlers::Ruby::AttributeHandler
  # e.g. identifier :foo, :bar

  handles method_call(:identifier), method_call(:identifiers)
  namespace_only

  def process
    identifiers = statement.parameters(false).map { |param| param.jump(:ident)[0] }
    namespace['nanoc_identifiers'] = identifiers
  end
end

class NanocRegisterFilterHandler < ::YARD::Handlers::Ruby::AttributeHandler
  # e.g. Nanoc::Filter.register '::Nanoc::Filters::AsciiDoc', :asciidoc

  handles method_call(:register)
  namespace_only

  def process
    target = statement.jump(:const_path_ref)
    return if target != s(:const_path_ref, s(:var_ref, s(:const, 'Nanoc')), s(:const, 'Filter'))

    class_name = statement.jump(:string_literal).jump(:tstring_content)[0]
    identifier = statement.jump(:symbol_literal).jump(:ident)[0]

    obj = YARD::Registry.at(class_name.sub(/^::/, ''))
    obj['nanoc_identifiers'] ||= []
    obj['nanoc_identifiers'] << identifier
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
nanoc-4.1.0 doc/yardoc_handlers/identifier.rb
nanoc-4.1.0rc2 doc/yardoc_handlers/identifier.rb
nanoc-4.1.0rc1 doc/yardoc_handlers/identifier.rb
nanoc-4.1.0b1 doc/yardoc_handlers/identifier.rb
nanoc-4.1.0a1 doc/yardoc_handlers/identifier.rb
nanoc-4.0.2 doc/yardoc_handlers/identifier.rb
nanoc-4.0.1 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0rc3 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0rc2 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0rc1 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0b4 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0b3 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0b2 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0b1 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0a2 doc/yardoc_handlers/identifier.rb
nanoc-4.0.0a1 doc/yardoc_handlers/identifier.rb
nanoc-3.8.0 doc/yardoc_handlers/identifier.rb
nanoc-3.7.5 doc/yardoc_handlers/identifier.rb