module JamfRubyExtensions::String::Conversions
Public Instance Methods
j_to_bool()
click to toggle source
Convert the strings “true” and “false” (after stripping whitespace and downcasing) to TrueClass and FalseClass respectively
Return nil if any other string.
@return [Boolean,nil] the boolean value
# File lib/jamf/ruby_extensions/string/conversions.rb 38 def j_to_bool 39 case strip.downcase 40 when 'true' then true 41 when 'false' then false 42 end # case 43 end
Also aliased as: jss_to_bool
j_to_pathname()
click to toggle source
Convert a String
to a Pathname
object
@return [Pathname]
# File lib/jamf/ruby_extensions/string/conversions.rb 71 def j_to_pathname 72 Pathname.new self 73 end
Also aliased as: jss_to_pathname
j_to_time()
click to toggle source
Convert a string to a Time
object
@see Jamf.parse_time
@return [Time] the time represented by the string, or nil
# File lib/jamf/ruby_extensions/string/conversions.rb 60 def j_to_time 61 Jamf.parse_time self 62 rescue 63 nil 64 end
Also aliased as: jss_to_time
j_to_timestamp()
click to toggle source
Convert a string to a Jamf::Timestamp
object
@return [Time] the time represented by the string.
# File lib/jamf/ruby_extensions/string/conversions.rb 50 def j_to_timestamp 51 Jamf::Timestamp.new self 52 end