Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc.rb

Instance Method Summary collapse

Instance Method Details

#strip_htmlString

Remove all HTML tags with at least one character name and decode all HTML entities into utf-8 characters.

Returns:

  • (String)

    stripped string



36
37
38
# File 'lib/wcc.rb', line 36

def strip_html
	HTMLEntities.new.decode(self.gsub(/<[^>]+>/, ' '))
end

#substring(i) ⇒ String

Returns all characters from the i-th to the end.

Parameters:

  • i (Integer)

    offset to start substring

Returns:

  • (String)

    slice(iā€¦length)



44
45
46
# File 'lib/wcc.rb', line 44

def substring(i)
	slice(i...length)
end