class TonSdk::Helper

Public Class Methods

base64_from_hex(hex_digest) click to toggle source
# File lib/ton_sdk_client/helper.rb, line 18
  def self.base64_from_hex(hex_digest) = [[hex_digest].pack("H*")].pack("m0")
end
capitalized_case_str_to_snake_case_sym(str) click to toggle source

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

# File lib/ton_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) click to toggle source

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

# File lib/ton_sdk_client/helper.rb, line 6
def self.sym_to_capitalized_case_str(symb)
  symb.to_s.split('_').map(&:capitalize).join
end