class YARD::CodeObjects::Placeholder
Constants
- CONSTANT_PATTERN
- DEFAULT_PLACE_HOLDER_REGEXP_STRING
Public Instance Methods
value()
click to toggle source
# File lib/yard/code_objects/placeholder.rb, line 8 def value return if @value.nil? unless @processed @processed = true loop do break if substitute_constants.nil? end end @value end
Private Instance Methods
constants_from_value(data=@value)
click to toggle source
Look through the specified data for the escape pattern and return an array of those constants found. This defaults to the @value within step transformer as it is used internally, however, it can be called externally if it's needed somewhere.
# File lib/yard/code_objects/placeholder.rb, line 31 def constants_from_value(data=@value) data.scan(CONSTANT_PATTERN).flatten.collect { |value| value.strip } end
find_value_for_constant(name)
click to toggle source
Looking through all the constants in the registry and returning the value with the regex items replaced from the constnat if present
# File lib/yard/code_objects/placeholder.rb, line 39 def find_value_for_constant(name) constant = YARD::Registry.all(:constant).find{|c| c.name == constant.to_sym } log.warn "StepTransformer#find_value_for_constant : Could not find the CONSTANT [#{name}] using the string value." unless constant constant ? constant.value : DEFAULT_PLACE_HOLDER_REGEXP_STRING end
substitute_constants()
click to toggle source
# File lib/yard/code_objects/placeholder.rb, line 21 def substitute_constants @value.gsub!(CONSTANT_PATTERN) do |_| find_value_for_constant($1) end end