Skip to content

Instantly share code, notes, and snippets.

@mbj
Last active December 17, 2015 15:08
Show Gist options
  • Save mbj/5629003 to your computer and use it in GitHub Desktop.
Save mbj/5629003 to your computer and use it in GitHub Desktop.
stats transformer
module Vehicles
class Transformer
# Namespace for stats ducktraps
Stats = Ducktrap::Mapper.build do
dumper do
part_dumper =
Ducktrap.build do
anima_dump(Vehicles::Import::Mobile::Part::Stats)
hash_transform do
fetch_key(:total) { dump_key('total') }
fetch_key(:invalid) { dump_key('invalid') }
fetch_key(:valid) { dump_key('valid') }
end
end
Ducktrap.build do
anima_dump(Vehicles::Import::Mobile::Stats)
hash_transform do
fetch_key(:vehicle) do
add(PART_DUMPER)
dump_key('vehicle')
end
fetch_key(:row) do
add(PART_DUMPER)
dump_key('row')
end
fetch_key(:entry) do
add(PART_DUMPER)
dump_key('entry')
end
fetch_key(:image) do
add(PART_DUMPER)
dump_key('image')
end
end
end
end # dumper
end # mapper
end # Transformer
end # Vehicles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment