Class: ParameterSubstitution::Formatters::HexToBase64

Inherits:
Base
  • Object
show all
Defined in:
lib/parameter_substitution/formatters/hex_to_base64.rb

Class Method Summary collapse

Methods inherited from Base

encoding, has_parameters?, key, parse_duration

Class Method Details

.descriptionObject



4
5
6
# File 'lib/parameter_substitution/formatters/hex_to_base64.rb', line 4

def self.description
  "Converts hex encoded strings to base64 encoding"
end

.format(value) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/parameter_substitution/formatters/hex_to_base64.rb', line 8

def self.format(value)
  raise ArgumentError, "Bad non-hex input to hex_to_base64" if value !~ /^\h+$/

  [[value].pack("H*")].pack("m0")
end