Created
February 28, 2014 10:41
-
-
Save adimasuhid/9268911 to your computer and use it in GitHub Desktop.
Piliponi Use
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Numbers | |
extend Piliponi | |
def self.csv_to_array(num_array, map_num) | |
num_array.collect{ |num| clean num[map_num] } | |
end | |
def self.rejected(numbers) | |
numbers.select{ |num| !plausible? num } | |
end | |
def self.formatted(numbers) | |
numbers.select{ |num| plausible? num }.map{|num| normalize num, format: :pure} | |
end | |
def self.normalize_csv(num_array, map_num) | |
num_array.map do |row| | |
row[map_num.to_i] = normalize(row[map_num.to_i], format: :pure) rescue nil | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment