module Quando
Constants
- VERSION
Public Class Methods
config()
click to toggle source
Quando's class-level configuration @return [Quando::Config]
# File lib/quando/config.rb, line 106 def self.config @config ||= Config.new end
configure() { |config| ... }
click to toggle source
@return [Quando::Config]
# File lib/quando/config.rb, line 111 def self.configure config unless @config yield(config) if block_given? @config end
parse(date, opts = {})
click to toggle source
@param date [String] @param opts [Hash] @option opts [Regexp, Array<Regexp>] :matcher @option opts [Integer] :century @return [Date, nil]
# File lib/quando.rb, line 15 def self.parse(date, opts = {}) return if (date = date.to_s.strip).empty? p = Parser.new if opts[:matcher] p.configure do |c| c.formats = [opts[:matcher]].flatten end end if opts[:century] p.configure do |c| c.century = opts[:century] end end p.parse(date) end
reset!()
click to toggle source
Reset Quando's class-level configuration to defaults @return [Quando::Config]
# File lib/quando/config.rb, line 119 def self.reset! @config = Config.new end