module Fog::Proxmox::String

module String mixins

Public Class Methods

to_boolean(text) click to toggle source
# File lib/fog/proxmox/string.rb, line 24
def self.to_boolean(text)
  return true if text == true || text =~ (/(true|t|yes|y|1)$/i)
  return false if text == false || text.empty? || text =~ (/(false|f|no|n|0)$/i)

  raise ArgumentError, "invalid value for Boolean: \"#{text}\""
end