Class: LAME::Delegation::TypeConvertor

Inherits:
Object
  • Object
show all
Defined in:
lib/lame/delegation.rb

Class Method Summary collapse

Class Method Details

.convert(value) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/lame/delegation.rb', line 44

def self.convert(value)
  case value
  when true
    1
  when false
    0
  when String
    ::FFI::MemoryPointer.from_string(value)
  else
    value
  end
end

.convert_return(value) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/lame/delegation.rb', line 57

def self.convert_return(value)
  case value
  when 0
    false
  else
    !!value
  end
end