comma-csv / comma

Comma is a small CSV (ie. comma separated values) generation extension for Ruby objects, that lets you seamlessly define a CSV output format via a small DSL

Home Page:https://github.com/comma-csv/comma

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Base One CSV Configuration Off of Another

mutewinter opened this issue · comments

I've got a model that has multiple CSV output types. Each output type adds data to the previous. It would be great if there was a way to keep this code DRY. Perhaps a syntax like:

comma :base do
  first_name
  last_name
  address
end
comma :more do
  extend :base
  city
  state
  zip
end

I think that this issue can be closed because of __use__ keyword. The example above can be written like:

comma :more do
  __use__ :base
  city
  state
  zip
end

Closing with above example and latest release, please let re-open if still an issue