Class: Ace::B36ts::Commands::DecodeCommand
- Inherits:
-
Object
- Object
- Ace::B36ts::Commands::DecodeCommand
- Defined in:
- lib/ace/b36ts/commands/decode_command.rb
Overview
Command to decode a compact ID to a timestamp
Class Method Summary collapse
-
.execute(compact_id, options = {}) ⇒ Integer
Execute the decode command.
Class Method Details
.execute(compact_id, options = {}) ⇒ Integer
Execute the decode command
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ace/b36ts/commands/decode_command.rb', line 22 def execute(compact_id, = {}) config = Molecules::ConfigResolver.resolve() display_config_summary("decode", config, ) # Use split decoding for hierarchical paths, otherwise auto-detect time = if [:split] || contains_split_separator?(compact_id) Atoms::CompactIdEncoder.decode_path( compact_id, year_zero: config[:year_zero], alphabet: config[:alphabet] ) else Atoms::CompactIdEncoder.decode_auto( compact_id, year_zero: config[:year_zero], alphabet: config[:alphabet] ) end output = format_output(time, [:format]) puts output 0 rescue ArgumentError => e warn "Error: #{e.}" raise rescue => e warn "Error decoding compact ID: #{e.}" warn e.backtrace.first(5).join("\n") if Ace::B36ts.debug? raise end |