Class: KDE::MimeType

Inherits:
Object show all
Defined in:
lib/ruber/kde_sugar.rb

Instance Method Summary collapse

Instance Method Details

#=~(str) ⇒ Object

Compares self with the string str. The comparison works as follows:

  • if str doesn’t start with ! or =, it works as KDE::MimeType#is

  • if str starts with !, returns the oppsite of KDE::MimeType#is

  • if str starts with =, makes an exact match between str and self.name

  • if str starts with != or =!, makes an exact match and inverts it



239
240
241
242
243
244
245
246
247
# File 'lib/ruber/kde_sugar.rb', line 239

def =~ str
  str = str.sub(/^([!=]{0,2})/, '')
  case $1
  when '!' then !(self.is str)
  when '=' then self.name == str
  when '!=', '=!' then !(self.name == str)
  else self.is str
  end
end