Class: String

Inherits:
Object show all
Defined in:
lib/microformat/string.rb

Direct Known Subclasses

Microformat::Simple, XOXO::Label

Instance Method Summary collapse

Instance Method Details

#coerceObject



4
5
6
7
8
9
10
11
# File 'lib/microformat/string.rb', line 4

def coerce
  return true if self == 'true'
  return false if self == 'false'
  coerce_try { return Time.iso8601(self) }
  coerce_try { return Integer(self) }
  coerce_try { return Float(self) }
  self
end

#strip_htmlObject



13
14
15
# File 'lib/microformat/string.rb', line 13

def strip_html
  gsub(/<(?:[^>'"]*|(['"]).*?\1)*>/,'')
end