Module: GirFFI::InfoExt::SafeConstantName

Defined in:
lib/gir_ffi/info_ext/safe_constant_name.rb

Overview

Extension module provinding a #safe_name method suitable for types.

Instance Method Summary collapse

Instance Method Details

#safe_nameObject



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

def safe_name
  name.tr('-', '_').gsub(/^./) do |char|
    case char
    when '_'
      'Private___'
    else
      char.upcase
    end
  end
end