lib/yard/handlers/base.rb in yard-0.6.1 vs lib/yard/handlers/base.rb in yard-0.6.2
- old
+ new
@@ -217,10 +217,37 @@
# a namespace.
def namespace_only?
(@namespace_only ||= false) ? true : false
end
+ # Declares that a handler should only be called when inside a filename
+ # by its basename or a regex match for the full path.
+ #
+ # @param [String, Regexp] filename a matching filename or regex
+ # @return [void]
+ # @since 0.6.2
+ def in_file(filename)
+ (@in_files ||= []) << filename
+ end
+
+ # @return [Boolean] whether the filename matches the declared file
+ # match for a handler. If no file match is specified, returns true.
+ # @since 0.6.2
+ def matches_file?(filename)
+ return true unless @in_files
+ @in_files.any? do |in_file|
+ case in_file
+ when String
+ File.basename(filename) == in_file
+ when Regexp
+ filename =~ in_file
+ else
+ true
+ end
+ end
+ end
+
# Generates a +process+ method, equivalent to +def process; ... end+.
# Blocks defined with this syntax will be wrapped inside an anonymous
# module so that the handler class can be extended with mixins that
# override the +process+ method without alias chaining.
#
@@ -425,13 +452,13 @@
else
nil
end
end
- if RUBY_PLATFORM =~ /java/ || defined?(::Rubinius)
+ unless CONTINUATIONS_SUPPORTED
unless $NO_CONTINUATION_WARNING
$NO_CONTINUATION_WARNING = true
- log.warn "JRuby/Rubinius do not implement Kernel#callcc and cannot " +
+ log.warn "JRuby/MacRuby/Rubinius do not implement Kernel#callcc and cannot " +
"load files in order. You must specify the correct order manually."
end
raise NamespaceMissingError, object
end
\ No newline at end of file