tatey / conformist Goto Github PK
View Code? Open in Web Editor NEWBend CSVs to your will with declarative schemas.
License: MIT License
Bend CSVs to your will with declarative schemas.
License: MIT License
For example a boolean columnis_company
is defined, which sets the column's content to be truthy or falsy:
#map salutation column to :is_company
column :is_company, 1 do |value|
value.downcase == 'firma'
end
Now another column is defined that sets its content based on the evaluation result of :is_company
column.
Currently my workaround for this is:
#map phone office dependent on whether record is a company record or not
column :phone_office, 1, 2, 3 do |values|
#raw data:
# values[0] == saluation
# values[1] == phone 1
# values[2] == phone 2
if values[0].downcase == 'firma'
values[1]
else
values[2]
end
end
But it would be mucher nicer to if one could access the already evaluated columns inside the preprocessing block:
column :phone_office, 2, 3 do |values, already_defined_columns|
#raw data:
# values[1] == phone 1
# values[2] == phone 2
if already_defined_columns[:is_company]
values[1]
else
values[2]
end
end
The spreadsheet gem converts Excel dates to a Date/DateTime object but this conversion does not get passed through to the conformist schema.
For example
spreadsheet.worksheet(0).row(1)
=> [1.0,
Fri, 19 Mar 2010,
Sat, 01 Sep 2001
]
enumerator.first
=> #<Conformist::HashStruct:0x007ffab9e75930
@attributes=
{:id=>1,
:first_date=>40256.484375,
:second_date=>37135.0}>
Is there a way of retaining the Date object?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.