class KnapsackPro::Crypto::BranchEncryptor

Constants

NON_ENCRYPTABLE_BRANCHES

Attributes

branch[R]

Public Class Methods

call(branch) click to toggle source
# File lib/knapsack_pro/crypto/branch_encryptor.rb, line 24
def self.call(branch)
  if KnapsackPro::Config::Env.branch_encrypted?
    new(branch).call
  else
    branch
  end
end
new(branch) click to toggle source
# File lib/knapsack_pro/crypto/branch_encryptor.rb, line 32
def initialize(branch)
  @branch = branch
end

Public Instance Methods

call() click to toggle source
# File lib/knapsack_pro/crypto/branch_encryptor.rb, line 36
def call
  if NON_ENCRYPTABLE_BRANCHES.include?(branch)
    branch
  else
    Digestor.salt_hexdigest(branch)[0..6]
  end
end