Add simple handlers

Add a base handler class and a handler that processes `HostClassDefinition`
instances.
This commit is contained in:
Charlie Sharpsteen 2014-05-22 23:45:08 -07:00
parent 9ef57b594e
commit c56bc426be
3 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,2 @@
require_relative 'handlers/base'
require_relative 'handlers/host_class_handler'

View File

@ -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

View File

@ -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