class String
Public Instance Methods
is_mp4?()
click to toggle source
Determine whether the path represented by the receiver is an MP4 video, whether or not it exists.
@return true If the file extension is .mp4, false Otherwise
# File lib/react_native_util/core_ext/string.rb, line 28 def is_mp4? video_type == :mp4 end
obfuscate()
click to toggle source
Get an obfuscated copy of the string. @see obfuscate!
@return [String] An obfuscated copy of self
# File lib/react_native_util/core_ext/string.rb, line 6 def obfuscate string = clone string.obfuscate! string end
obfuscate!()
click to toggle source
Obfuscates the receiver by first replacing all instances of the HOME environment variable with '~' and then all instances of USER with '$USER'. @see obfuscate
@return nil
# File lib/react_native_util/core_ext/string.rb, line 18 def obfuscate! gsub!(/#{Regexp.quote ENV['HOME']}/, '~') gsub!(/#{Regexp.quote ENV['USER']}/, '$USER') nil end
video_type()
click to toggle source
Returns the video type for the path represented by the receiver, whether or not the file exists. This is just the file extension as a lowercase symbol, e.g. :mp4, :mov, :avi, etc.
@return [Symbol] The file extension as a lowercase symbol
# File lib/react_native_util/core_ext/string.rb, line 38 def video_type # Just file extension as a symbol File.extname(self).sub(/^\./, '').downcase.to_sym end