Module: GirFFI::InfoExt::SafeConstantName
- Included in:
- GObjectIntrospection::ICallbackInfo, GObjectIntrospection::IConstantInfo, GObjectIntrospection::IRegisteredTypeInfo, GObjectIntrospection::ISignalInfo, GObjectIntrospection::IVFuncInfo
- 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_name ⇒ Object
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 |