all repos — markup @ 606dfa12397db75c61a4c7f971c91c49380af011

The code we use to render README.your_favorite_markup

cache file extension regexp instead of recompiling it every time
Charlie Somerville charlie@charliesomerville.com
Wed, 04 Dec 2013 11:31:13 +1100
commit

606dfa12397db75c61a4c7f971c91c49380af011

parent

f6f0e0b580edd0bdefc1232775be59ffaa2e3f8d

1 files changed, 6 insertions(+), 1 deletions(-)

jump to
M lib/github/markup/implementation.rblib/github/markup/implementation.rb

@@ -16,7 +16,12 @@ raise NotImplementedError, "subclasses of GitHub::Markup::Implementation must define #render"

end def match?(filename) - Regexp.compile("\\.(#{regexp})$") =~ filename + file_ext_regexp =~ filename + end + + private + def file_ext_regexp + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end