add a markups accessor method for @@markups
Charlie Somerville charlie@charliesomerville.com
Wed, 04 Dec 2013 12:01:13 +1100
2 files changed,
9 insertions(+),
5 deletions(-)
M
lib/github/markup.rb
→
lib/github/markup.rb
@@ -6,8 +6,12 @@ module Markup
extend self @@markups = [] + def markups + @@markups + end + def preload! - @@markups.each do |markup| + markups.each do |markup| markup.load end end@@ -23,7 +27,7 @@ end
end def markup(file, pattern, opts = {}, &block) - @@markups << GemImplementation.new(pattern, file, &block) + markups << GemImplementation.new(pattern, file, &block) end def command(command, regexp, &block)@@ -31,7 +35,7 @@ if File.exists?(file = File.dirname(__FILE__) + "/commands/#{command}")
command = file end - @@markups << CommandImplementation.new(regexp, command, &block) + markups << CommandImplementation.new(regexp, command, &block) end def can_render?(filename)@@ -39,7 +43,7 @@ !!renderer(filename)
end def renderer(filename) - @@markups.find { |impl| + markups.find { |impl| impl.match?(filename) } end
M
lib/github/markups.rb
→
lib/github/markups.rb
@@ -1,6 +1,6 @@
require "github/markup/markdown" -@@markups << GitHub::Markup::Markdown.new +markups << GitHub::Markup::Markdown.new markup(:redcloth, /textile/) do |content| RedCloth.new(content).to_html