Module: Quando
- Defined in:
- lib/quando.rb,
lib/quando/config.rb,
lib/quando/parser.rb,
lib/quando/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'0.0.3'
Class Method Summary collapse
- .config ⇒ Quando::Config
- .configure {|config| ... } ⇒ Object
- .parse(date, opts = {}) ⇒ Date?
- .reset! ⇒ Object
Class Method Details
.config ⇒ Quando::Config
69 70 71 |
# File 'lib/quando/config.rb', line 69 def self.config @config ||= Config.new end |
.configure {|config| ... } ⇒ Object
73 74 75 76 |
# File 'lib/quando/config.rb', line 73 def self.configure config unless @config yield(config) if block_given? end |
.parse(date, opts = {}) ⇒ Date?
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/quando.rb', line 13 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 p.parse(date) end |
.reset! ⇒ Object
78 79 80 |
# File 'lib/quando/config.rb', line 78 def self.reset! @config = Config.new end |