Add simple handlers
Add a base handler class and a handler that processes `HostClassDefinition` instances.
This commit is contained in:
parent
9ef57b594e
commit
c56bc426be
|
@ -0,0 +1,2 @@
|
|||
require_relative 'handlers/base'
|
||||
require_relative 'handlers/host_class_handler'
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue