Module: L43::Time::Tools::FormatTs
- Extended by:
- FormatTs
- Includes:
- Core
- Included in:
- FormatTs
- Defined in:
- lib/l43/time/tools/format_ts.rb
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
Instance Method Details
#format_ts(ts, **opts) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/l43/time/tools/format_ts.rb', line 23 def format_ts(ts, **opts) = Options.new(timestamp: ts, **opts) ts = ts.strip case split_parts(ts, options:) in :ok, parts format_parts(parts, options:) in error error end end |
#format_ts!(ts, **opts) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/l43/time/tools/format_ts.rb', line 34 def format_ts!(ts, **opts) case format_ts(ts, **opts) in :ok, value value in :error, raise BadFormat, end end |