class String

Public Instance Methods

to_dec() click to toggle source
# File lib/ffi/struct_ex/struct_ex.rb, line 10
def to_dec
  case self
    when /^[+-]?\d+$/
      self.to_i
    when /^[+-]?0[xX][\da-fA-F_]+$/
      self.to_i(16)
    when /^[+-]?0[bB][_01]+$/
      self.to_i(2)
  end
end