Module: Chronicle::Util
- Defined in:
- lib/chronicle/util.rb
Class Method Summary collapse
Class Method Details
.coerce_to_hash(input) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/chronicle/util.rb', line 4 def coerce_to_hash(input) case input when Hash input when ActionController::Parameters input.to_unsafe_h else raise ArgumentError, 'Input expected to be a hash' end end |
.parse_date(str) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/chronicle/util.rb', line 15 def parse_date(str) return nil if str.blank? begin Date.parse(str) rescue StandardError nil end end |