class String

Public Instance Methods

blank?() click to toggle source
# File lib/tm2gsv/extensions.rb, line 19
def blank?
  self.strip == ""
end
color?() click to toggle source
# File lib/tm2gsv/extensions.rb, line 23
def color?
  if self.include? '#' and self.size > 6
    return true
  end

  return false
end
color_with_alpha?() click to toggle source
# File lib/tm2gsv/extensions.rb, line 31
def color_with_alpha?
  if self.include? '#' and self.size > 7
    return true
  end

  return false
end
dasherize() click to toggle source
# File lib/tm2gsv/extensions.rb, line 47
def dasherize
  self.downcase.gsub(/[^0-9A-Za-z]/, ' ').squeeze(' ').gsub(' ', '-').strip
end
to_hex_alpha() click to toggle source
# File lib/tm2gsv/extensions.rb, line 43
def to_hex_alpha
  (100 * ((self[7,8]).to_i(16) / 255.0)).round
end
to_hex_color() click to toggle source
# File lib/tm2gsv/extensions.rb, line 39
def to_hex_color
  self[0..6]
end