Class String
In: lib/rir/string.rb
Parent: Object

Extention of the standard class String with useful function.

Methods

Included Modules

RIR

Public Instance methods

Returns the text values inside all occurences of a XML tag in self

  s = "four-piece in <a href='#'>Indianapolis</a>, <a href='#'>Indiana</a> at the Murat Theatre"
  s.extract_xmltags_values 'a' #=> ["Indianapolis", "Indiana"]

Returns true if self belongs to Rir::Stoplist, false otherwise.

Do not use. TODO: rewamp. find why this function is here.

Removes all Javascript sources from self.

  s = "<script type='text/javascript'>
        var skin='vector',
        stylepath='http://bits.wikimedia.org/skins-1.5'
       </script>

       test"
  s.strip_javascripts                   #=> "test"

Removes all Javascript sources from self.

  s = "<script type='text/javascript'>
        var skin='vector',
        stylepath='http://bits.wikimedia.org/skins-1.5'
       </script>

       test"
  s.strip_javascripts!
  s                                     #=> "test"

Removes punctuation from self.

  s = "hello, world. how are you?!"
  s.strip_punctuation               # => "hello world how are you"

Removes punctuation from self.

  s = "hello, world. how are you?!"
  s.strip_punctuation!
  s                                 # => "hello world how are you"

Removes all XML-like tags from self.

  s = "<html><body>test</body></html>"
  s.strip_xml_tags                      #=> "test"
  s                                     #=> "<html><body>test</body></html>"

Removes all XML-like tags from self.

  s = "<html><body>test</body></html>"
  s.strip_xml_tags!
  s                                     #=> "test"

[Validate]