Class: Snippr::Processor::Functions

Inherits:
Object
  • Object
show all
Defined in:
lib/snippr/processor/functions.rb

Instance Method Summary collapse

Instance Method Details

#process(content, opts = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/snippr/processor/functions.rb', line 11

def process(content, opts = {})
  content.scan(/\{(.*?):(.*?)\}/) do |match|
    command, func_options = match
    options = opts.merge(hashify(func_options))
    command = "cmd_#{command}"
    content = send(command, content, options, func_options) if respond_to?(command, true)
  end
  content
end