module Grokdown::Matching
Public Class Methods
extended(base)
click to toggle source
# File lib/grokdown/matching.rb, line 9 def extended(base) @@knowns.push(base) end
for(node)
click to toggle source
# File lib/grokdown/matching.rb, line 17 def for(node) @@knowns.find {|i| i.matches?(node)} end
matches?(node)
click to toggle source
# File lib/grokdown/matching.rb, line 13 def matches?(node) @@knowns.any? {|i| i.matches?(node)} end
Also aliased as: ===
Public Instance Methods
match(&block)
click to toggle source
# File lib/grokdown/matching.rb, line 24 def match(&block) @matcher = block end
matches?(node)
click to toggle source
# File lib/grokdown/matching.rb, line 28 def matches?(node) node.is_a?(self) || (node.is_a?(CommonMarker::Node) && @matcher.call(node)) end
Also aliased as: ===