Sha256: 9853cb3793c23c5d15e04676c478015fedaa48546886ddb491ba75c6089d4af0
Contents?: true
Size: 1.1 KB
Versions: 3
Compression:
Stored size: 1.1 KB
Contents
#!/usr/bin/env ruby require "flex_station_data/services/load_plates" require "flex_station_data/presenters/plates_csv" module FlexStationData class SampleDataApp include Concerns::Service OPTION_RE = /\A--(\w+(?:-\w+)*)(?:=(.*))?\z/.freeze attr_reader :args, :options def initialize(*args) @options, @args = args.partition { |arg| arg =~ OPTION_RE } @options.map! do |option| option.scan(OPTION_RE).first end end def threshold name, value = options.reverse.detect { |name, value| name == "threshold" } return nil if name.blank? Float(value) end def files @files ||= args.map { |arg| Pathname(arg) } end def plates @plates ||= files.map do |file| [ file, LoadPlates.call(file) ] end end def csv plates.flat_map do |file, file_plates| Presenters::PlatesCsv.present(file, file_plates, threshold: threshold) end end def call CSV do |out| csv.each do |row| out << row end end end end end FlexStationData::SampleDataApp.call(*ARGV)
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flex-station-data-0.3.2 | bin/flex-station-sample-data |
flex-station-data-0.3.1 | bin/flex-station-sample-data |
flex-station-data-0.3.0 | bin/flex-station-sample-data |