Dispatch enter and leave events for RegularExpressionNode
nodes and continue walking the tree.
returns an integer in (-infty, 0] a number closer to 0 means the dependency is less constraining
dependencies w/ 0 or 1 possibilities (ignoring version requirements) are given very negative values, so they always sort first, before dependencies that are unconstrained
Invoked by IO.select
to ask whether the specified descriptors are ready for specified events within the specified timeout
.
Expected to return the 3-tuple of Array
of IOs that are ready.
Returns a list of encodings in Content-Encoding field as an array of strings.
The encodings are downcased for canonicalization.
Like Enumerable#map
, but chains operation to be lazy-evaluated.
(1..Float::INFINITY).lazy.map {|i| i**2 } #=> #<Enumerator::Lazy: #<Enumerator::Lazy: 1..Infinity>:map> (1..Float::INFINITY).lazy.map {|i| i**2 }.first(3) #=> [1, 4, 9]
Like Enumerable#select
, but chains operation to be lazy-evaluated.
Sets the encoding that should be used when reading the body:
If the given value is an Encoding
object, that encoding will be used.
Otherwise if the value is a string, the value of Encoding#find(value) will be used.
Otherwise an encoding will be deduced from the body itself.
Examples:
http = Net::HTTP.new(hostname) req = Net::HTTP::Get.new('/') http.request(req) do |res| p res.body.encoding # => #<Encoding:ASCII-8BIT> end http.request(req) do |res| res.body_encoding = "UTF-8" p res.body.encoding # => #<Encoding:UTF-8> end
Returns reference counter of Dispatch interface of WIN32OLE
object. You should not use this method because this method exists only for debugging WIN32OLE
.
Counts objects for each T_IMEMO
type.
This method is only for MRI developers interested in performance and memory usage of Ruby programs.
It returns a hash as:
{:imemo_ifunc=>8, :imemo_svar=>7, :imemo_cref=>509, :imemo_memo=>1, :imemo_throw_data=>1}
If the optional argument, result_hash, is given, it is overwritten and returned. This is intended to avoid probe effect.
The contents of the returned hash is implementation specific and may change in the future.
In this version, keys are symbol objects.
This method is only expected to work with C Ruby.
Like URI.encode_www_form_component
, except that ' '
(space) is encoded as '%20'
(instead of '+'
).
Removes the named instance variable from obj, returning that variable’s value. String
arguments are converted to symbols.
class Dummy attr_reader :var def initialize @var = 99 end def remove remove_instance_variable(:@var) end end d = Dummy.new d.var #=> 99 d.remove #=> 99 d.var #=> nil
Defines a public singleton method in the receiver. The method parameter can be a Proc
, a Method
or an UnboundMethod
object. If a block is specified, it is used as the method body. If a block or a method has parameters, they’re used as method parameters.
class A class << self def class_name to_s end end end A.define_singleton_method(:who_am_i) do "I am: #{class_name}" end A.who_am_i # ==> "I am: A" guy = "Bob" guy.define_singleton_method(:hello) { "#{self}: Hello there!" } guy.hello #=> "Bob: Hello there!" chris = "Chris" chris.define_singleton_method(:greet) {|greeting| "#{greeting}, I'm Chris!" } chris.greet("Hi") #=> "Hi, I'm Chris!"
Execute the provided block, but preserve the rounding mode
BigDecimal.save_rounding_mode do BigDecimal.mode(BigDecimal::ROUND_MODE, :up) puts BigDecimal.mode(BigDecimal::ROUND_MODE) end
For use with the BigDecimal::ROUND_*
See BigDecimal.mode
Invoked as a callback whenever a singleton method is added to the receiver.
module Chatty def Chatty.singleton_method_added(id) puts "Adding #{id.id2name}" end def self.one() end def two() end def Chatty.three() end end
produces:
Adding singleton_method_added Adding one Adding three