Sha256: 91595eedd57e3c8cc45102100580faaea48a76f4c71a67f0bbca04f75fdd01f2
Contents?: true
Size: 1012 Bytes
Versions: 1
Compression:
Stored size: 1012 Bytes
Contents
class String # returns a hash like params containing all the "get" params from a given url # Ex: # 'http://wiki.rego.co.il/doku.php?id=development:horizon3:plugins:core_extensions:start&do=edit&rev='.to_params # => {:id=>'development:horizon3:plugins:core_extensions:start', :do=>'edit', :rev=>nil} def to_params hash = {} params=self.split("?") if params.size > 1 params=params[1].split("&") params=params.collect{|param| param.split("=")} params.each do |param| hash[param[0].to_sym]=param[1] end end hash end # converts string to either TrueClass or FalseClass. If converion can't be made, returns nil def to_boolean s = self.downcase.strip if s == 'true' true elsif s == 'false' false else nil end end # matches and replaces placeholders in form of %{foo} or %<foo> def interpolate(values_hash = {}, options = {}) StringInterpolation.interpolate(self, values_hash, options) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rego-ruby-ext-0.0.7 | lib/string-ext.rb |