Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/trackman/utility/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#embedded?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/trackman/utility/core_extensions.rb', line 14

def embedded?
  self.include? 'data:'
end

#internal_path?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/trackman/utility/core_extensions.rb', line 11

def internal_path? 
  self !~ /^http/
end

#trackman_underscoreObject



3
4
5
6
7
8
9
10
# File 'lib/trackman/utility/core_extensions.rb', line 3

def trackman_underscore
  word = dup
  word.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
  word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
  word.tr!("-", "_")
  word.downcase!
  word
end