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.3.7 doc/yardoc_handlers/identifier.rb
nanoc-4.3.6 doc/yardoc_handlers/identifier.rb
nanoc-4.3.5 doc/yardoc_handlers/identifier.rb
nanoc-4.3.4 doc/yardoc_handlers/identifier.rb
nanoc-4.3.3 doc/yardoc_handlers/identifier.rb
nanoc-4.3.2 doc/yardoc_handlers/identifier.rb
nanoc-4.3.1 doc/yardoc_handlers/identifier.rb
nanoc-4.3.0 doc/yardoc_handlers/identifier.rb
nanoc-4.2.4 doc/yardoc_handlers/identifier.rb
nanoc-4.2.3 doc/yardoc_handlers/identifier.rb
nanoc-4.2.2 doc/yardoc_handlers/identifier.rb
nanoc-4.2.1 doc/yardoc_handlers/identifier.rb
nanoc-4.2.0 doc/yardoc_handlers/identifier.rb
nanoc-4.1.6 doc/yardoc_handlers/identifier.rb
nanoc-4.2.0b1 doc/yardoc_handlers/identifier.rb
nanoc-4.1.5 doc/yardoc_handlers/identifier.rb
nanoc-4.1.4 doc/yardoc_handlers/identifier.rb
nanoc-4.1.3 doc/yardoc_handlers/identifier.rb
nanoc-4.1.2 doc/yardoc_handlers/identifier.rb
nanoc-4.1.1 doc/yardoc_handlers/identifier.rb