Immutable and read-only representation of a timestamp token info from a Response
.
Class for representing WebDAV method UNLOCK:
require 'net/http' uri = URI('http://example.com') hostname = uri.hostname # => "example.com" req = Net::HTTP::Unlock.new(uri) # => #<Net::HTTP::Unlock UNLOCK> res = Net::HTTP.start(hostname) do |http| http.request(req) end
See Request Headers.
Related:
Net::HTTP#unlock
: sends UNLOCK
request, returns response object.
A FetchError
that indicates that the reason for not being able to fetch data was that the host could not be contacted
Error raised when no cdylib artifact was created
IO
wrapper that allows writing a limited amount of data
Returns a new Array
containing those elements from self
that are not duplicates, the first occurrence always being retained.
With no block given, identifies and omits duplicates using method eql?
to compare:
a = [0, 0, 1, 1, 2, 2] a.uniq # => [0, 1, 2]
With a block given, calls the block for each element; identifies (using method eql?
) and omits duplicate values, that is, those elements for which the block returns the same value:
a = ['a', 'aa', 'aaa', 'b', 'bb', 'bbb'] a.uniq {|element| element.size } # => ["a", "aa", "aaa"]
With no block, returns a new array containing only unique elements; the array has no two elements e0
and e1
such that e0.eql?(e1)
:
%w[a b c c b a a b c].uniq # => ["a", "b", "c"] [0, 1, 2, 2, 1, 0, 0, 1, 2].uniq # => [0, 1, 2]
With a block, returns a new array containing elements only for which the block returns a unique value:
a = [0, 1, 2, 3, 4, 5, 5, 4, 3, 2, 1] a.uniq {|i| i.even? ? i : 0 } # => [0, 2, 4] a = %w[a b c d e e d c b a a b c d e] a.uniq {|c| c < 'c' } # => ["a", "c"]
Like Enumerable#uniq
, but chains operation to be lazy-evaluated.
Returns a new Array
that is the union of self
and all given Arrays other_arrays
; duplicates are removed; order is preserved; items are compared using eql?
:
[0, 1, 2, 3].union([4, 5], [6, 7]) # => [0, 1, 2, 3, 4, 5, 6, 7] [0, 1, 1].union([2, 1], [3, 1]) # => [0, 1, 2, 3] [0, 1, 2, 3].union([3, 2], [1, 0]) # => [0, 1, 2, 3]
Returns a copy of self
if no arguments given.
Related: Array#|
.
Returns a new regexp that is the union of the given patterns:
r = Regexp.union(%w[cat dog]) # => /cat|dog/ r.match('cat') # => #<MatchData "cat"> r.match('dog') # => #<MatchData "dog"> r.match('cog') # => nil
For each pattern that is a string, Regexp.new(pattern)
is used:
Regexp.union('penzance') # => /penzance/ Regexp.union('a+b*c') # => /a\+b\*c/ Regexp.union('skiing', 'sledding') # => /skiing|sledding/ Regexp.union(['skiing', 'sledding']) # => /skiing|sledding/
For each pattern that is a regexp, it is used as is, including its flags:
Regexp.union(/foo/i, /bar/m, /baz/x) # => /(?i-mx:foo)|(?m-ix:bar)|(?x-mi:baz)/ Regexp.union([/foo/i, /bar/m, /baz/x]) # => /(?i-mx:foo)|(?m-ix:bar)|(?x-mi:baz)/
With no arguments, returns /(?!)/
:
Regexp.union # => /(?!)/
If any regexp pattern contains captures, the behavior is unspecified.
creates a new socket connected to path using UNIX socket socket.
If a block is given, the block is called with the socket. The value of the block is returned. The socket is closed when this method returns.
If no block is given, the socket is returned.
# talk to /tmp/sock socket. Socket.unix("/tmp/sock") {|sock| t = Thread.new { IO.copy_stream(sock, STDOUT) } IO.copy_stream(STDIN, sock) t.join }
returns an addrinfo object for UNIX socket address.
socktype specifies the socket type. If it is omitted, :STREAM is used.
Addrinfo.unix("/tmp/sock") #=> #<Addrinfo: /tmp/sock SOCK_STREAM> Addrinfo.unix("/tmp/sock", :DGRAM) #=> #<Addrinfo: /tmp/sock SOCK_DGRAM>