Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/jss-api/compatibility.rb,
lib/jss-api/ruby_extensions/string.rb

Instance Method Summary collapse

Instance Method Details

#force_encoding(args = nil) ⇒ Object



64
# File 'lib/jss-api/compatibility.rb', line 64

def force_encoding(args = nil); self; end

#jss_to_boolBoolean?

Convert the strings “true” and “false” (after stripping whitespace and downcasing) to TrueClass and FalseClass respectively

Return nil if any other string.

Returns:

  • (Boolean, nil)

    the boolean value



36
37
38
39
40
41
42
# File 'lib/jss-api/ruby_extensions/string.rb', line 36

def jss_to_bool
  case self.strip.downcase
    when "true" then return true
    when "false" then return false
    else return nil
  end # case
end