Sha256: 2701cc8e2086c788305dac866f4bc2c442ad6e6efc67c465117adf9fd0d1303c
Contents?: true
Size: 580 Bytes
Versions: 1
Compression:
Stored size: 580 Bytes
Contents
require 'lou/version' require 'lou/transformer' module Lou def self.extended(base) base.class_eval do @transforms = [] end end def transform Transformer.new.tap do |t| @transforms << t end end def apply(input) output = deep_clone(input) @transforms.each do |t| output = t.apply(output) end output end def reverse(output) input = deep_clone(output) @transforms.reverse_each do |t| input = t.reverse(input) end input end def deep_clone(obj) Marshal.load(Marshal.dump(obj)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lou-0.1.0 | lib/lou.rb |