Module: Roebe::RemoveHtml

Defined in:
lib/roebe/modules/remove_html.rb

Overview

Roebe::RemoveHtml

Class Method Summary collapse

Class Method Details

.[](i = ARGF) ⇒ Object

#

Roebe::RemoveHtml[]

Usage example:

Roebe::RemoveHtml['string with <span>some</span> html here'] # => "string with some html here"
#


29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/roebe/modules/remove_html.rb', line 29

def self.[](i = ARGF)
  if i.is_a? Array
    if i.empty?
      i << 'abc<def>ghi'
    end
    i = i.flatten.compact.join(' ')
  end
  if i.respond_to?(:read)
    i = i.read
  end
  return i.gsub(/\<.+?\>/,'')
end