Class: MediaWiki::Utils
- Inherits:
-
Object
- Object
- MediaWiki::Utils
- Defined in:
- lib/mediawiki/utils.rb
Overview
Util class similar to MediaWiki’s non-API JavaScript util methods.
To use this class it must be explicitly required. Including mediawiki/butt
does not automatically include this class.
Its methods are class methods, not instance methods. They are not executed on your Butt instance.
Class Method Summary collapse
-
.encode_url(str) ⇒ String
Encodes the URL like mw.util.rawurlencode JS.
Class Method Details
.encode_url(str) ⇒ String
Encodes the URL like mw.util.rawurlencode JS.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/mediawiki/utils.rb', line 15 def self.encode_url(str) str.gsub!(/!/, '%21') str.gsub!(/'/, '%27') str.gsub!(/\(/, '%28') str.gsub!(/\)/, '%29') str.gsub!(/\*/, '%2A') str.gsub!(/~/, '%7E') str end |