# Defines a special property type that represents a boolean state.
# @param name [Symbol] name of the new flag
# @param default_value [Boolean] what value to use for the flag if neither assertion statement is invoked.
# @param inherited: [Boolean] If this property will, when not explicitly set, inherit the value from it's parent resource tree.
# @!macro [attach] flag_dsl
# @!group Properties
#
# @!method $1?
# Tests if the flag is currently true or false.
# @return [Boolean]
# @!method $1
# Asserts that the $1 flag should be set to true. (Default: $2)
# @return [true]
# @!method not_$1
# Asserts that the $1 flag should be set to false. (Default: $2)
# @return [false]
# @!method set_$1?
# Tests if the flag has been explicity set or if {$1?} will return the default value.
# @return [Boolean]
#
# @!endgroup
def flag(name, default_value, inherited: false)
Sorry about the slow response to this question:
> Is the fact that I'm extending that module into a base class possibly the cause?
I'm not sure. I believe that macros used to execute at their location of declaration but I think that was fixed in one of the last releases. It might be that this bug is still present in some cases. I would recommend filing an issue with a minimal repro case to track that so we can fix or provide workarounds.
Regards,
Loren
--
---
You received this message because you are subscribed to the Google Groups "YARD" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yardoc+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def class_method?object && object.is_a?(CodeObjects::MethodObject) &&(object.scope == :class || !object.module_function?)end
# A module mixin to create an interface mixin. Generally for IoC delegates.
# @abstract
module InterfaceDSL
# Signifies that a concrete representation of this interface may optionally implement this method.
# @param method [Symbol] the name of the method this is describing.
# @param required_for: [Symbol] what source method, if any, requires this method to be implemented.
# @return [void]
# @!macro [attach] may_implement
# @!method $1
# test
def may_implement(method, required_for: nil)
end
end
parser.tags.each do |tag|next if tag.is_a?(Tags::RefTagList) # we don't handle this yetnext unless tag.tag_name == "param"tag_name = tag.name.gsub(/\W/, '')
if seen_names.include?(tag_name)log.warn "@param tag has duplicate parameter name: " \"#{tag.name} #{infile_info}"elsif names.include?(tag_name)seen_names << tag_nameelselog.warn "@param tag has unknown parameter name: " \"#{tag.name} #{infile_info}"end
end
# Defines a special property type that represents a boolean state.
# @param name [Symbol] name of the new flag# @param default_value [Boolean] what value to use for the flag if neither assertion statement is invoked.# @param inherited: [Boolean] If this property will, when not explicitly set, inherit the value from it's parent resource tree.
# @return [void]
# @!macro [attach] flag_dsl
# @!group Properties
# @!method $1?# Tests if the flag is currently true or false.# @return [Boolean]
# @!group Properties
# @!method $1# Asserts that the $1 flag should be set to true. (Default: $2)
# @return [true]
# @!group Properties
# @!method not_$1# Asserts that the $1 flag should be set to false. (Default: $2)
# @return [false]
# @!group Properties
# @!method set_$1?# Tests if the flag has been explicitly set or if {$1?} will return the default value.
# @return [Boolean]# @!endgroup
def flag(name, default_value, inherited: false)
I also just realized how bad those code blocks can appear in some email client, sorry bout that. Viewing it on the website may make reading a lot easier.
You received this message because you are subscribed to a topic in the Google Groups "YARD" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/yardoc/zNcDupZD6oE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to yardoc+un...@googlegroups.com.
Hey Bryan,
Sometimes code renders fine in this thread, sometimes it does not. ¯\_(ツ)_/¯
> The source of the macro firing on the original method seems to be related to my usage of Modules
> to define the DSL and then extending them into Classes. ...
So based on your minimal repro and some other digging I did manage to reproduce some of your issues. I dug up this old similar issue https://github.com/lsegal/yard/issues/1019 which has a workaround recommendation that seems to still work in your case. The issue should have been fixed but I guess there are still some edge cases, or possibly even a regression.
In any case, the following modified workaround from the
above issue seems to work on your snippet, albeit a little
hacky:
> On grouping, I attempted to apply your suggestions.
You would want to put the group directive in the method body. The workaround example above shows how to achieve that.
> Additionally, I was having an issue with certain @param tags.
In the above example putting the colon on required_for
results in (imho) better documentation. However, it starts
outputting warnings that the param is unrecognized. I traced
this back to `docstring_parser.rb` and it's after_parse callback.
This is intentional. The correct parameter name, even for keyword args, is the parameter name without the suffix colon. Note that it's just a warning, so YARD will render whatever you want, but the warning will likely remain since the expectation is to use the bare parameter. This makes it easier for tools to process these parameter names. That said, YARD could indeed do a better job calling
> I'd offer to do PRs but I'm unable to contribute directly to the project,
A PR may not be feasible for you (if this is a corporate thing and not a time-constraint issue feel free to reach out privately as I'm ex-Amazon and know a thing or two about the OSS policies there), but at the very least it would be nice if you could file issues for the bugs you've encountered at http://github.com/lsegal/yard/issues -- code not required, but putting it there will help get it on the radar for upcoming releases.
Hope this helps,
Loren
Realized I missed a sentence in my response:
> That said, YARD could indeed do a better job calling
Should read:
That said, YARD could indeed do a better job calling out keyword parameters in rendered HTML output where possible-- I assume this is what you're looking for when you say you see the colon yielding better docs. If someone wanted to make a PR for this, it would be looked at.
Loren