Results for: "uniq"

Releases the lock. Raises ThreadError if mutex wasn’t locked by the current thread.

Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Thread::Mutex.

Finishes the converter. It returns the last part of the converted string.

ec = Encoding::Converter.new("utf-8", "iso-2022-jp")
p ec.convert("\u3042")     #=> "\e$B$\""
p ec.finish                #=> "\e(B"

Returns HTML-unescaped string.

Returns URL-unescaped string following RFC 3986.

Returns URL-unescaped string (application/x-www-form-urlencoded).

URL-decode an application/x-www-form-urlencoded string with encoding(optional).

string = CGI.unescape("%27Stop%21%27+said+Fred")
   # => "'Stop!' said Fred"

URL-decode a string following RFC 3986 with encoding(optional).

string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
   # => "'Stop!'+said Fred"

Unescape a string that has been HTML-escaped

CGI.unescapeHTML("Usage: foo "bar" <baz>")
   # => "Usage: foo \"bar\" <baz>"

Undo escaping such as that done by CGI.escapeElement()

print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
  # "&lt;BR&gt;<A HREF="url"></A>"

print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
  # "&lt;BR&gt;<A HREF="url"></A>"

Finishes the digest and returns the resulting hash value.

This method is overridden by each implementation subclass and often made private, because some of those subclasses may leave internal data uninitialized. Do not call this method from outside. Use digest!() instead, which ensures that internal data be reset for security reasons.

Pushes character c back onto the stream such that a subsequent buffered character read will return it.

Unlike IO#getc multiple bytes may be pushed back onto the stream.

Has no effect on unbuffered reads (such as sysread).

Returns true if field 'Transfer-Encoding' exists and has value 'chunked', false otherwise; see Transfer-Encoding response header:

res = Net::HTTP.get_response(hostname, '/todos/1')
res['Transfer-Encoding'] # => "chunked"
res.chunked?             # => true

Create a new NilNode node

Create a new UndefNode node

Create a new UnlessNode node

Create a new UntilNode node

Zlib::GzipReader wrapper that unzips data.

No documentation available

Replaces the content of self with the content of other_array; returns self:

a = [:foo, 'bar', 2]
a.replace(['foo', :bar, 3]) # => ["foo", :bar, 3]

Replaces the contents of self with the contents of other_string:

s = 'foo'        # => "foo"
s.replace('bar') # => "bar"

Invoked as a callback whenever an instance method is undefined from the receiver.

module Chatty
  def self.method_undefined(method_name)
    puts "Undefining #{method_name.inspect}"
  end
  def self.some_class_method() end
  def some_instance_method() end
  class << self
    undef_method :some_class_method
  end
  undef_method :some_instance_method
end

produces:

Undefining :some_instance_method

Prevents the current class from responding to calls to the named method. Contrast this with remove_method, which deletes the method from the particular class; Ruby will still search superclasses and mixed-in modules for a possible receiver. String arguments are converted to symbols.

class Parent
  def hello
    puts "In parent"
  end
end
class Child < Parent
  def hello
    puts "In child"
  end
end

c = Child.new
c.hello

class Child
  remove_method :hello  # remove from child, still in parent
end
c.hello

class Child
  undef_method :hello   # prevent any calls to 'hello'
end
c.hello

produces:

In child
In parent
prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)

Creates module functions for the named methods. These functions may be called with the module as a receiver, and also become available as instance methods to classes that mix in the module. Module functions are copies of the original, and so may be changed independently. The instance-method versions are made private. If used with no arguments, subsequently defined methods become module functions. String arguments are converted to symbols. If a single argument is passed, it is returned. If no argument is passed, nil is returned. If multiple arguments are passed, the arguments are returned as an array.

module Mod
  def one
    "This is one"
  end
  module_function :one
end
class Cls
  include Mod
  def call_one
    one
  end
end
Mod.one     #=> "This is one"
c = Cls.new
c.call_one  #=> "This is one"
module Mod
  def one
    "This is the new one"
  end
end
Mod.one     #=> "This is one"
c.call_one  #=> "This is the new one"

Returns the number of decimal significant digits in self.

BigDecimal("0").n_significant_digits         # => 0
BigDecimal("1").n_significant_digits         # => 1
BigDecimal("1.1").n_significant_digits       # => 2
BigDecimal("3.1415").n_significant_digits    # => 5
BigDecimal("-1e20").n_significant_digits     # => 1
BigDecimal("1e-20").n_significant_digits     # => 1
BigDecimal("Infinity").n_significant_digits  # => 0
BigDecimal("-Infinity").n_significant_digits # => 0
BigDecimal("NaN").n_significant_digits       # => 0
Search took: 2ms  ·  Total Results: 462