class Todonotes::Todo
Report the ToDo/FixMe and count occurence.
The first occurence is reported as a warning, next occurences are informations.
end¶ ↑
Attributes
count[R]
result[R]
Temporary result of the Todo
. This result should become a 'real' value
short_description[R]
Public Class Methods
new(codeline, type, comment, logger) { || ... }
click to toggle source
end¶ ↑
# File lib/todonotes/todo.rb, line 14 def initialize(codeline, type, comment, logger, &block) @logger = logger @count = 1 @codeline = codeline @type = type @shortdescription = comment #Build result @result = yield if block_given? #The Todonotes::FixmeFormatter can handle array in a special way to reformat the output. @logger.warn([@type, "#{@codeline} #{@shortdescription} (temporary: #{@result.inspect})"]) end
Public Instance Methods
call() { || ... }
click to toggle source
Todo/Fixme is called again
end¶ ↑
# File lib/todonotes/todo.rb, line 34 def call() #The Todonotes::FixmeFormatter can handle array in a special way to reformat the output. @logger.info([@type, "#{@codeline}(#{@count}) #{@shortdescription} (temporary: #{@result.inspect})"]) @count += 1 @result = yield if block_given? #re-evaluate block end
infoline(settings)
click to toggle source
Return a single line with status of the todo.
Depending on with_type you get also the type (ToDo/FixMe)
end ¶ ↑
# File lib/todonotes/todo.rb, line 50 def infoline(settings) res = @codeline.dup res << " (%-5s)" % @type if settings.include?(:with_type) res << ": %4i call%s" % [ @count, @count > 1 ? 's': '' ] res << " (%s)" % @shortdescription if settings.include?(:with_shortdescription) res << " = '#{@result.inspect}'" if settings.include?(:with_result) res end