Merge pull request #174 from eputnam/pdoc240
(PDOC-240) add handling for :array node type in rsapi_handler
This commit is contained in:
commit
2ec1b24051
|
@ -44,7 +44,7 @@ class PuppetStrings::Yard::Handlers::Ruby::RsapiHandler < PuppetStrings::Yard::H
|
||||||
private
|
private
|
||||||
|
|
||||||
def raise_parse_error(msg, location = statement)
|
def raise_parse_error(msg, location = statement)
|
||||||
raise YARD::Parser::UndocumentableError, "#{msg} at #{location.file}:#{location.line}." if parameters.empty?
|
raise YARD::Parser::UndocumentableError, "#{msg} at #{location.file}:#{location.line}."
|
||||||
end
|
end
|
||||||
|
|
||||||
# check that the params of the register_type call are key/value pairs.
|
# check that the params of the register_type call are key/value pairs.
|
||||||
|
@ -67,6 +67,8 @@ class PuppetStrings::Yard::Handlers::Ruby::RsapiHandler < PuppetStrings::Yard::H
|
||||||
node.source.to_i
|
node.source.to_i
|
||||||
when :hash
|
when :hash
|
||||||
hash_from_node(node)
|
hash_from_node(node)
|
||||||
|
when :array
|
||||||
|
array_from_node(node)
|
||||||
when :var_ref
|
when :var_ref
|
||||||
var_ref_from_node(node)
|
var_ref_from_node(node)
|
||||||
when :symbol, :symbol_literal, :label, :dyna_symbol, :string_literal
|
when :symbol, :symbol_literal, :label, :dyna_symbol, :string_literal
|
||||||
|
@ -76,6 +78,14 @@ class PuppetStrings::Yard::Handlers::Ruby::RsapiHandler < PuppetStrings::Yard::H
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def array_from_node(node)
|
||||||
|
return nil unless node
|
||||||
|
|
||||||
|
arr = node.children.collect do |assoc|
|
||||||
|
value_from_node(assoc.children[0])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def hash_from_node(node)
|
def hash_from_node(node)
|
||||||
return nil unless node
|
return nil unless node
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ SOURCE
|
||||||
Puppet::ResourceApi.register_type(
|
Puppet::ResourceApi.register_type(
|
||||||
name: 'database',
|
name: 'database',
|
||||||
docs: 'An example database server resource type.',
|
docs: 'An example database server resource type.',
|
||||||
|
features: ['remote-resource'],
|
||||||
attributes: {
|
attributes: {
|
||||||
ensure: {
|
ensure: {
|
||||||
type: 'Enum[present, absent, up, down]',
|
type: 'Enum[present, absent, up, down]',
|
||||||
|
|
Loading…
Reference in New Issue