Class: EverSdk::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/ever_sdk_client/helper.rb

Class Method Summary collapse

Class Method Details

.base64_from_hex(hex_digest) ⇒ Object



18
# File 'lib/ever_sdk_client/helper.rb', line 18

def self.base64_from_hex(hex_digest) = [[hex_digest].pack("H*")].pack("m0")

.capitalized_case_str_to_snake_case_sym(str) ⇒ Object

converts a capital-case string into a symbol AaaBbbCcc –> :aaa_bbb_ccc



14
15
16
# File 'lib/ever_sdk_client/helper.rb', line 14

def self.capitalized_case_str_to_snake_case_sym(str)
  str.split(/(?=[A-Z])/).map(&:downcase).join("_").to_sym
end

.sym_to_capitalized_case_str(symb) ⇒ Object

converts a symbol which may contain _, into a capital-case string :aaa_bbb_ccc -> AaaBbbCcc



6
7
8
# File 'lib/ever_sdk_client/helper.rb', line 6

def self.sym_to_capitalized_case_str(symb)
  symb.to_s.split('_').map(&:capitalize).join
end