Results for: "Dir.chdir"

No documentation available
No documentation available
No documentation available
No documentation available

Args

v

String

Description

Public setter for the scheme component v (with validation).

See also URI::Generic.check_scheme.

Usage

require 'uri'

uri = URI.parse("http://my.example.com")
uri.scheme = "https"
uri.to_s  #=> "https://my.example.com"

Returns true if URI is hierarchical.

Description

URI has components listed in order of decreasing significance from left to right, see RFC3986 tools.ietf.org/html/rfc3986 1.2.3.

Usage

require 'uri'

uri = URI.parse("http://my.example.com/")
uri.hierarchical?
#=> true
uri = URI.parse("mailto:joe@example.com")
uri.hierarchical?
#=> false

Checks if URI has a path. For URI::LDAP this will return false.

Return value associated with key.

If there is no value for key and no block is given, returns ifnone.

Otherwise, calls block passing in the given key.

See ::DBM#fetch for more information.

No documentation available

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

Iterates over keys and values. Note that unlike other collections, each without block isn’t supported.

See IO#getch.

Like getc, but raises an exception if already at end-of-stream; see Character IO.

Executes the block for every line in the stream where lines are separated by eol.

See also gets

Reads a one-character string from the stream. Raises an EOFError at end of file.

Generate a Checkbox Input element as a string.

The attributes of the element can be specified as three arguments, name, value, and checked. checked is a boolean value; if true, the CHECKED attribute will be included in the element.

Alternatively, the attributes can be specified as a hash.

checkbox("name")
  # = checkbox("NAME" => "name")

checkbox("name", "value")
  # = checkbox("NAME" => "name", "VALUE" => "value")

checkbox("name", "value", true)
  # = checkbox("NAME" => "name", "VALUE" => "value", "CHECKED" => true)

With a block, returns the string value for key if it exists; otherwise returns the value of the block; ignores the default_val; see Fields:

res = Net::HTTP.get_response(hostname, '/todos/1')

# Field exists; block not called.
res.fetch('Connection') do |value|
  fail 'Cannot happen'
end # => "keep-alive"

# Field does not exist; block called.
res.fetch('Nosuch') do |value|
  value.downcase
end # => "nosuch"

With no block, returns the string value for key if it exists; otherwise, returns default_val if it was given; otherwise raises an exception:

res.fetch('Connection', 'Foo') # => "keep-alive"
res.fetch('Nosuch', 'Foo')     # => "Foo"
res.fetch('Nosuch')            # Raises KeyError.
No documentation available

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

returns a charset parameter in Content-Type field. It is downcased for canonicalization.

If charset parameter is not given but a block is given, the block is called and its result is returned. It can be used to guess charset.

If charset parameter and block is not given, nil is returned except text type. In that case, “utf-8” is returned as defined by RFC6838 4.2.1

Create a new CaseMatchNode node

Create a new InterpolatedMatchLastLineNode node

Create a new MatchLastLineNode node

Create a new MatchWriteNode node

Generate a string that randomly draws from a source array of characters.

The argument source specifies the array of characters from which to generate the string. The argument n specifies the length, in characters, of the string to be generated.

The result may contain whatever characters are in the source array.

require 'random/formatter'

prng.choose([*'l'..'r'], 16) #=> "lmrqpoonmmlqlron"
prng.choose([*'0'..'9'], 5)  #=> "27309"
Search took: 3ms  ·  Total Results: 1391