Class: Marko::Markup::Macro
- Inherits:
-
Object
- Object
- Marko::Markup::Macro
- Defined in:
- lib/marko/markup/macro.rb
Overview
Base class for macro substitutions
Class Method Summary collapse
Instance Method Summary collapse
-
#gsub!(text, obj = nil) ⇒ Object
substitutes all occured #pattern it text.
-
#pattern ⇒ Regexp
Pattern to process.
Class Method Details
.pattern ⇒ Object
28 29 30 |
# File 'lib/marko/markup/macro.rb', line 28 def self.pattern @pattern end |
Instance Method Details
#gsub!(text, obj = nil) ⇒ Object
substitutes all occured #pattern it text
38 39 40 41 |
# File 'lib/marko/markup/macro.rb', line 38 def gsub!(text, obj = nil) fn = subfn(text, obj) text.scan(pattern).each(&fn) end |
#pattern ⇒ Regexp
Returns pattern to process.
33 34 35 |
# File 'lib/marko/markup/macro.rb', line 33 def pattern self.class.pattern end |