Module: GirFFI::InfoExt::SafeConstantName

Overview

Extension module provinding a #safe_name method suitable for types.

Instance Method Summary collapse

Instance Method Details

#safe_nameObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/gir_ffi/info_ext/safe_constant_name.rb', line 7

def safe_name
  name.tr("-", "_").sub(/^[_a-z]/) do |char|
    case char
    when "_"
      "Private___"
    else
      char.upcase
    end
  end
end