Sha256: ec7f98b2d7a45687ae3a424a686af5e960f39e938b0f61ee3d6efbf7f4af3b58

Contents?: true

Size: 351 Bytes

Versions: 3

Compression:

Stored size: 351 Bytes

Contents

module SquareBracket::Postprocess
  REGEX = /\[([^ \[\]]+) ?([^\[\]]*)\]/

  def postprocess(string)
    string.gsub REGEX do |match|
      method = $1
      params = $2
      if @square_bracket_post_processor.respond_to? method
        @square_bracket_post_processor.send(method, *params.split)
      else
        match
      end
    end   
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
square_bracket-0.0.3 lib/square_bracket/postprocess.rb
square_bracket-0.0.2 lib/square_bracket/postprocess.rb
square_bracket-0.0.1 lib/square_bracket/postprocess.rb