Class: Aspera::CommandLineConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/aspera/command_line_converter.rb

Overview

conversion class for transfer spec values to CLI values (ascp)

Class Method Summary collapse

Class Method Details

.base64(value) ⇒ Object

special encoding methods used in YAML (key: convert)



15
# File 'lib/aspera/command_line_converter.rb', line 15

def base64(value); Base64.strict_encode64(value); end

.json64(value) ⇒ Object

special encoding methods used in YAML (key: convert)



12
# File 'lib/aspera/command_line_converter.rb', line 12

def json64(value); Base64.strict_encode64(JSON.generate(value)); end

.kbps_to_bps(value) ⇒ Object

Kbps to bps



27
28
29
# File 'lib/aspera/command_line_converter.rb', line 27

def kbps_to_bps(value)
  1000 * value.to_i
end

.remove_hyphen(value) ⇒ Object

special encoding methods used in YAML (key: convert)



9
# File 'lib/aspera/command_line_converter.rb', line 9

def remove_hyphen(value); value.tr('-', ''); end

.yes_to_true(value) ⇒ Object

transform yes/no to true/false



18
19
20
21
22
23
24
# File 'lib/aspera/command_line_converter.rb', line 18

def yes_to_true(value)
  case value
  when 'yes' then return true
  when 'no' then return false
  else Aspera.error_unexpected_value(value){'only: yes or no: '}
  end
end