diff --git a/lib/puppetx/yardoc/yard/handlers.rb b/lib/puppetx/yardoc/yard/handlers.rb new file mode 100644 index 0000000..085dc55 --- /dev/null +++ b/lib/puppetx/yardoc/yard/handlers.rb @@ -0,0 +1,2 @@ +require_relative 'handlers/base' +require_relative 'handlers/host_class_handler' diff --git a/lib/puppetx/yardoc/yard/handlers/base.rb b/lib/puppetx/yardoc/yard/handlers/base.rb new file mode 100644 index 0000000..b23e58b --- /dev/null +++ b/lib/puppetx/yardoc/yard/handlers/base.rb @@ -0,0 +1,14 @@ +require 'puppetx/yardoc' +require 'yard' +require 'puppet/pops' + +module Puppetx::Yardoc::YARD::Handlers + class Base < YARD::Handlers::Base + include Puppet::Pops::Model # This allows handlers to match based on model classes. + + def self.handles?(statement) + handlers.any? {|h| h == statement.type} + end + + end +end diff --git a/lib/puppetx/yardoc/yard/handlers/host_class_handler.rb b/lib/puppetx/yardoc/yard/handlers/host_class_handler.rb new file mode 100644 index 0000000..6db7856 --- /dev/null +++ b/lib/puppetx/yardoc/yard/handlers/host_class_handler.rb @@ -0,0 +1,11 @@ +require_relative 'base' + +module Puppetx::Yardoc::YARD::Handlers + class HostClassHandler < Base + handles HostClassDefinition + + process do + register YARD::CodeObjects::ClassObject.new(:root, statement.pops_obj.name) + end + end +end