Sha256: f3439f2e4d7796d3956ddf73adbe2552941e70cb329d9370728b5a372b99d8b2
Contents?: true
Size: 993 Bytes
Versions: 9
Compression:
Stored size: 993 Bytes
Contents
<% redirect do |target| %># <%= const.name %>::manifest <replace with manifest summary> # <replace with command line description> # <%= const.const_name %> Documentation # This example FileTask counts the specified letters # in a source file and writes the counts to a target # file as YAML. # class <%= const.const_name %> < Tap::FileTask # <config file documentation> config :letters, ['a','e','i','o','u'], &c.array # a list of letters to count def process(source, target) # prepare ensures the parent directory for target # exists and, if necessary, backs up the existing # target file (which is restored on error) prepare(target) # now perform the task... str = File.read(source) letter_count = letters.collect do |letter| str.count(letter) end File.open(target, "wb") do |file| file << YAML.dump(letter_count) end target end end <% module_nest(const.nesting, ' ') { target } end %>
Version data entries
9 entries across 9 versions & 2 rubygems