Sha256: 0e3b44928f3ec93e78e0ed7a6bc50195d89bc52852e451d8650f60fe039455c1
Contents?: true
Size: 749 Bytes
Versions: 2
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true require 'terminal-table' module Kovid module_function def info_table(message) rows = [[message.to_s]] puts Terminal::Table.new title: '❗️', rows: rows end # Parse date as "02 Apr, 20" def dateman(date) date_to_parse = Date.strptime(date, '%m/%d/%y').to_s Date.parse(date_to_parse).strftime('%d %b, %y') end def comma_delimit(number) number.to_s.chars.to_a.reverse.each_slice(3).map(&:join).join(',').reverse end # Insert + sign to format positive numbers def add_plus_sign(num) num.to_i.positive? ? "+#{comma_delimit(num)}" : comma_delimit(num).to_s end def lookup_us_state(state) Kovid::Constants::USA_ABBREVIATIONS.fetch(state.downcase, state) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kovid-0.7.1 | lib/kovid/helpers.rb |
kovid-0.7.0 | lib/kovid/helpers.rb |