Class: String

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

Instance Method Summary collapse

Instance Method Details

#escape_htmlObject



18
19
20
# File 'lib/feed2email/core_ext.rb', line 18

def escape_html
  CGI.escapeHTML(self)
end

#numeric?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/feed2email/core_ext.rb', line 22

def numeric?
  to_i.to_s == self
end

#pluralize(count, plural = self + 's') ⇒ Object



26
27
28
# File 'lib/feed2email/core_ext.rb', line 26

def pluralize(count, plural = self + 's')
  "#{count} #{count == 1 ? self : plural}"
end

#strip_htmlObject



30
31
32
# File 'lib/feed2email/core_ext.rb', line 30

def strip_html
  CGI.unescapeHTML(Sanitize.clean(self))
end

#to_markdownObject



34
35
36
# File 'lib/feed2email/core_ext.rb', line 34

def to_markdown
  ReverseMarkdown.convert(self, unknown_tags: :drop)
end