I just heard of Chronic and wanted to integrate it with Highline so i
could get natural language dates like "yesterday", "tomorrow" etc.

I find that I get a nil returned if I do:

  dob1       = ask("DOB?  ", Chronic)

However, if i try this it works:

 class NameClass
   def self.parse( string )
     Chronic.parse(string)
   end

 end

 dob       = ask("Date?  ", NameClass)

Looking thru source reveals that :

      elsif [Date, DateTime].include?(@answer_type) or
@answer_type.is_a?(Class)
        @answer_type.parse(answer_string)

Now Chronic is a module not a class. So i guess in this case no part of
the "case" was called.
Now my question is:
1. Should there be a respond_to in the Highline case, or perhaps a check
for module also ?

2. Is there anyway i can do this in one line without modifying highline,
and without creating a separate class. Is there some block method or
param i could use to invoke Chronic.parse ?

thanks.
-- 
Posted via http://www.ruby-forum.com/.