Results for: "module_function"

Activate all unambiguously resolved runtime dependencies of this spec. Add any ambiguous dependencies to the unresolved list to be resolved later, as needed.

Sets rdoc_options to value, ensuring it is an array.

List of dependencies that will automatically be activated at runtime.

No documentation available

Message to promote available RubyGems update with related gem update command.

Get a single optional argument from the command line. If more than one argument is given, return only the first. Return nil if none are given.

Foo::Bar += baz ^^^^^^^^^^^^^^^

Foo::Bar &&= baz ^^^^^^^^^^^^^^^^

Foo::Bar ||= baz ^^^^^^^^^^^^^^^^

Foo::Bar += baz ^^^^^^^^^^^^^^^

Foo::Bar &&= baz ^^^^^^^^^^^^^^^^

Foo::Bar ||= baz ^^^^^^^^^^^^^^^^

Perform hostname verification following RFC 6125.

This method MUST be called after calling connect to ensure that the hostname of a remote peer has been verified.

No documentation available
No documentation available

Return the 2 dependency objects that conflicted

Returns a hash of the name/value pairs, to use in pattern matching. Possible keys are: :year, :month, :day, :wday, :yday.

Possible usages:

d = Date.new(2022, 10, 5)

if d in wday: 3, day: ..7  # uses deconstruct_keys underneath
  puts "first Wednesday of the month"
end
#=> prints "first Wednesday of the month"

case d
in year: ...2022
  puts "too old"
in month: ..9
  puts "quarter 1-3"
in wday: 1..5, month:
  puts "working day in month #{month}"
end
#=> prints "working day in month 10"

Note that deconstruction by pattern can also be combined with class check:

if d in Date(wday: 3, day: ..7)
  puts "first Wednesday of the month"
end

Returns a hash of the name/value pairs, to use in pattern matching. Possible keys are: :year, :month, :day, :wday, :yday, :hour, :min, :sec, :sec_fraction, :zone.

Possible usages:

dt = DateTime.new(2022, 10, 5, 13, 30)

if d in wday: 1..5, hour: 10..18  # uses deconstruct_keys underneath
  puts "Working time"
end
#=> prints "Working time"

case dt
in year: ...2022
  puts "too old"
in month: ..9
  puts "quarter 1-3"
in wday: 1..5, month:
  puts "working day in month #{month}"
end
#=> prints "working day in month 10"

Note that deconstruction by pattern can also be combined with class check:

if d in DateTime(wday: 1..5, hour: 10..18, day: ..7)
  puts "Working time, first week of the month"
end

Returns a hash of the name/value pairs, to use in pattern matching. Possible keys are: :year, :month, :day, :yday, :wday, :hour, :min, :sec, :subsec, :dst, :zone.

Possible usages:

t = Time.utc(2022, 10, 5, 21, 25, 30)

if t in wday: 3, day: ..7  # uses deconstruct_keys underneath
  puts "first Wednesday of the month"
end
#=> prints "first Wednesday of the month"

case t
in year: ...2022
  puts "too old"
in month: ..9
  puts "quarter 1-3"
in wday: 1..5, month:
  puts "working day in month #{month}"
end
#=> prints "working day in month 10"

Note that deconstruction by pattern can also be combined with class check:

if t in Time(wday: 3, day: ..7)
  puts "first Wednesday of the month"
end

Clone internal hash.

Returns a hash of the name/value pairs for the given member names.

Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345)
h = joe.deconstruct_keys([:zip, :address])
h # => {:zip=>12345, :address=>"123 Maple, Anytown NC"}

Returns all names and values if array_of_names is nil:

h = joe.deconstruct_keys(nil)
h # => {:name=>"Joseph Smith, Jr.", :address=>"123 Maple, Anytown NC", :zip=>12345}

Returns an address of the socket suitable for connect in the local machine.

This method returns self.local_address, except following condition.

If the local address is not suitable for connect, SocketError is raised. IPv4 and IPv6 address which port is 0 is not suitable for connect. Unix domain socket which has no path is not suitable for connect.

Addrinfo.tcp("0.0.0.0", 0).listen {|serv|
  p serv.connect_address #=> #<Addrinfo: 127.0.0.1:53660 TCP>
  serv.connect_address.connect {|c|
    s, _ = serv.accept
    p [c, s] #=> [#<Socket:fd 4>, #<Socket:fd 6>]
  }
}

creates a new Socket connected to the address of local_addrinfo.

If local_addrinfo is nil, the address of the socket is not bound.

The timeout specify the seconds for timeout. Errno::ETIMEDOUT is raised when timeout occur.

If a block is given the created socket is yielded for each address.

creates a socket connected to the address of self.

If one or more arguments given as local_addr_args, it is used as the local address of the socket. local_addr_args is given for family_addrinfo to obtain actual address.

If local_addr_args is not given, the local address of the socket is not bound.

The optional last argument opts is options represented by a hash. opts may have following options:

:timeout

specify the timeout in seconds.

If a block is given, it is called with the socket and the value of the block is returned. The socket is returned otherwise.

Addrinfo.tcp("www.ruby-lang.org", 80).connect_from("0.0.0.0", 4649) {|s|
  s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
  puts s.read
}

# Addrinfo object can be taken for the argument.
Addrinfo.tcp("www.ruby-lang.org", 80).connect_from(Addrinfo.tcp("0.0.0.0", 4649)) {|s|
  s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
  puts s.read
}

creates a socket connected to remote_addr_args and bound to self.

The optional last argument opts is options represented by a hash. opts may have following options:

:timeout

specify the timeout in seconds.

If a block is given, it is called with the socket and the value of the block is returned. The socket is returned otherwise.

Addrinfo.tcp("0.0.0.0", 4649).connect_to("www.ruby-lang.org", 80) {|s|
  s.print "GET / HTTP/1.0\r\nHost: www.ruby-lang.org\r\n\r\n"
  puts s.read
}
Search took: 11ms  ·  Total Results: 5313