Giter Site home page Giter Site logo

conformist's Issues

Make already evaluated columns accessible to preprocessing block

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

Excel representation of date being returned instead of DateTime object (spreadsheet gem)

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.