Sha256: 6af70fd0920b972ee71be09de00faedd7f8b59938bb70b9b79419d1b77aa3bf9
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
require 'rubygems' require 'processr' # Setup Processr.configure do |config| config.root = File.expand_path(File.dirname(__FILE__)) config.out = nil end puts "Simple text concatenation:" processor = Processr.new processor << "Some Text\n" processor << "Some More Text" puts processor.process! puts "Simple text concatenation form files:" processor = Processr.new processor.files << File.join('..', 'spec', 'fixtures', 'one.txt') processor.files << File.join('..', 'spec', 'fixtures', 'two.txt') puts processor.process! puts "Simple textile filter using input:" TextileFilter = lambda do |buffer| lookup = { /_(.*)_/ => '<em>\1</em>', /\*(.*)\*/ => '<strong>\1</strong>', /\"(.*)\":(\S*)/ => '<a href="\2">\1</a>' } lookup.each_pair do |regex, replacement| buffer.gsub!(regex, replacement) end buffer end processor = Processr.new processor.add_filter(TextileFilter) processor << 'A _simple_ example of a "textile":http://www.textism.com/tools/textile/ parser using a *filter*.' puts processor.process!
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
processr-0.9.2 | examples/all.rb |
processr-0.9.0 | examples/all.rb |