Class: Exchange::Helper
- Inherits:
-
Object
- Object
- Exchange::Helper
- Extended by:
- SingleForwardable
- Includes:
- Singleton
- Defined in:
- lib/exchange/helper.rb
Overview
Helper Functions that get used throughout the gem can be placed here
Instance Method Summary collapse
-
#assure_time(arg = nil, opts = {}) ⇒ Object
A helper function to assure a value is an instance of time.
Instance Method Details
#assure_time(arg = nil, opts = {}) ⇒ Object
A helper function to assure a value is an instance of time
21 22 23 24 25 26 27 |
# File 'lib/exchange/helper.rb', line 21 def assure_time arg=nil, opts={} if arg arg.kind_of?(Time) ? arg : Time.gm(*arg.split('-')) elsif opts[:default] Time.send(opts[:default]) end end |