Sha256: b3b26c95de558a7c876566545e95eea0c6db4e21baf6c1a38e879a9fd3e42fdb

Contents?: true

Size: 814 Bytes

Versions: 9

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true
module GirFFI
  module InfoExt
    # Extension module provinding a #safe_name method suitable for types.
    module SafeConstantName
      def safe_name
        name.tr('-', '_').gsub(/^./) do |char|
          case char
          when '_'
            'Private___'
          else
            char.upcase
          end
        end
      end
    end
  end
end

GObjectIntrospection::ICallbackInfo.send :include, GirFFI::InfoExt::SafeConstantName
GObjectIntrospection::IConstantInfo.send :include, GirFFI::InfoExt::SafeConstantName
GObjectIntrospection::IRegisteredTypeInfo.send :include, GirFFI::InfoExt::SafeConstantName
GObjectIntrospection::ISignalInfo.send :include, GirFFI::InfoExt::SafeConstantName
GObjectIntrospection::IVFuncInfo.send :include, GirFFI::InfoExt::SafeConstantName

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.11.1 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.11.0 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.10.2 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.10.1 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.10.0 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.10.0.pre1 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.9.5 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.9.4 lib/gir_ffi/info_ext/safe_constant_name.rb
gir_ffi-0.9.3 lib/gir_ffi/info_ext/safe_constant_name.rb