Class: ActiveSupport::HashWithIndifferentAccess
- Inherits:
-
Object
- Object
- ActiveSupport::HashWithIndifferentAccess
- Defined in:
- lib/bookable/generators/bookable/templates/models/datetime.rb
Instance Method Summary collapse
Instance Method Details
#to_datetime(name) ⇒ Object
2 3 4 5 |
# File 'lib/bookable/generators/bookable/templates/models/datetime.rb', line 2 def to_datetime(name) units = select{|k,v| k.match /#{name}\(..\)/}.map{|k,v| v.to_i} DateTime.new(*units) end |