From 18fefbbbd25537e5f458ac794f297a09a0a619f3 Mon Sep 17 00:00:00 2001 From: tduehr Date: Thu, 21 May 2015 09:18:01 -0500 Subject: better native_type --- lib/ffi/enum.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/ffi/enum.rb b/lib/ffi/enum.rb index 1b0b898..0e84ba7 100644 --- a/lib/ffi/enum.rb +++ b/lib/ffi/enum.rb @@ -85,6 +85,7 @@ module FFI include DataConverter attr_reader :tag + attr_reader :native_type # @overload initialize(info, tag=nil) # @param [nil, Enumerable] info @@ -94,7 +95,7 @@ module FFI # @param [nil, Enumerable] info symbols and values for new Enum # @param [nil, Symbol] tag name of new Enum def initialize(*args) - @native_type = args.shift if args.first.kind_of?(FFI::Type) + @native_type = args.first.kind_of?(FFI::Type) ? args.shift : Type::INT info, @tag = *args @kv_map = Hash.new unless info.nil? @@ -149,12 +150,6 @@ module FFI alias to_h symbol_map alias to_hash symbol_map - # Get native type of Enum - # @return [Type] - def native_type - @native_type || Type::INT - end - # @param [Symbol, Integer, #to_int] val # @param ctx unused # @return [Integer] value of a enum symbol -- cgit v1.2.1