Gets all hostnames for address
from the DNS
resolver.
address
must be a Resolv::IPv4
, Resolv::IPv6
or a String. Retrieved names will be Resolv::DNS::Name
instances.
This method retrieves the name of the notation.
Method
contributed by Henrik Martensson
FIXME This probably won’t work properly
Name of the gem
The name of the unresolved dependency
extract the host part of the URI
and unwrap brackets for IPv6 addresses.
This method is same as URI::Generic#host
except brackets for IPv6 (and future IP) addresses are removed.
u = URI("http://[::1]/bar") p u.hostname #=> "::1" p u.host #=> "[::1]"
set the host part of the URI
as the argument with brackets for IPv6 addresses.
This method is same as URI::Generic#host=
except the argument can be bare IPv6 address.
u = URI("http://foo/bar") p u.to_s #=> "http://foo/bar" u.hostname = "::1" p u.to_s #=> "http://[::1]/bar"
If the argument seems IPv6 address, it is wrapped by brackets.
v
String
public setter for the path component v
. (with validation)
see also URI::Generic.check_path
require 'uri' uri = URI.parse("http://my.example.com/pub/files") uri.path = "/faq/" # => "/faq/" uri #=> #<URI::HTTP:0x000000008e89e8 URL:http://my.example.com/faq/>
Returns the conversion path of ec.
The result is an array of conversions.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP", crlf_newline: true) p ec.convpath #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>], # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>], # "crlf_newline"]
Each element of the array is a pair of encodings or a string. A pair means an encoding conversion. A string means a decorator.
In the above example, [#<Encoding:ISO-8859-1>,
Sets the name and the expanded name
The server hostname
The server hostname
When invoked with a block, yields all combinations of length n
of elements from the array and then returns the array itself.
The implementation makes no guarantees about the order in which the combinations are yielded.
If no block is given, an Enumerator
is returned instead.
Examples:
a = [1, 2, 3, 4] a.combination(1).to_a #=> [[1],[2],[3],[4]] a.combination(2).to_a #=> [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]] a.combination(3).to_a #=> [[1,2,3],[1,2,4],[1,3,4],[2,3,4]] a.combination(4).to_a #=> [[1,2,3,4]] a.combination(0).to_a #=> [[]] # one combination of length 0 a.combination(5).to_a #=> [] # no combinations of length 5
Returns a list of the names of public and protected methods of obj. This will include all the methods accessible in obj’s ancestors. If the optional parameter is false
, it returns an array of obj<i>‘s public and protected singleton methods, the array will not include methods in modules included in <i>obj.
class Klass def klass_method() end end k = Klass.new k.methods[0..9] #=> [:klass_method, :nil?, :===, # :==~, :!, :eql? # :hash, :<=>, :class, :singleton_class] k.methods.length #=> 56 k.methods(false) #=> [] def k.singleton_method; end k.methods(false) #=> [:singleton_method] module M123; def m123; end end k.extend M123 k.methods(false) #=> [:singleton_method]
Looks up the named method as a receiver in obj, returning a Method
object (or raising NameError
). The Method
object acts as a closure in obj’s object instance, so instance variables and the value of self
remain available.
class Demo def initialize(n) @iv = n end def hello() "Hello, @iv = #{@iv}" end end k = Demo.new(99) m = k.method(:hello) m.call #=> "Hello, @iv = 99" l = Demo.new('Fred') m = l.method("hello") m.call #=> "Hello, @iv = Fred"
Returns self.
Returns 1.