M
Michael Linfield
if i have a list of dates in an array such as:
4/2/07
4/3/07
4/4/07
4/5/07
4/6/07
4/7/07
4/8/07
ect.
how would i..based on option parse..pull a starting point and end point
of to extract that data range.
IE:
opts = OptionParser.new do |opts|
opts.on("-s", "--startdate", "What start date to use." do |i|
#code to determine to use the starting date
end
# the same would apply to an --enddate
any ideas?
i was thinking i could possibly create a new range depending on what the
user input was by doing
require 'date'
results = []
(Date.new(2007,4,1)..Date.new(2007,4,8)).each {|r| res << r}
but then how would i match that against the original dates for the data?
feel free to give me any thoughts.
-Thanks
4/2/07
4/3/07
4/4/07
4/5/07
4/6/07
4/7/07
4/8/07
ect.
how would i..based on option parse..pull a starting point and end point
of to extract that data range.
IE:
opts = OptionParser.new do |opts|
opts.on("-s", "--startdate", "What start date to use." do |i|
#code to determine to use the starting date
end
# the same would apply to an --enddate
any ideas?
i was thinking i could possibly create a new range depending on what the
user input was by doing
require 'date'
results = []
(Date.new(2007,4,1)..Date.new(2007,4,8)).each {|r| res << r}
but then how would i match that against the original dates for the data?
feel free to give me any thoughts.
-Thanks