Results for: "Pathname"

Args

oth

URI or String

Description

Destructive form of merge.

Usage

require 'uri'

uri = URI.parse("http://my.example.com")
uri.merge!("/main.rbx?page=1")
uri.to_s  # => "http://my.example.com/main.rbx?page=1"

Args

oth

URI or String

Description

Merges two URIs.

Usage

require 'uri'

uri = URI.parse("http://my.example.com")
uri.merge("/main.rbx?page=1")
# => "http://my.example.com/main.rbx?page=1"

Returns attributes.

Setter for attributes val.

Args

uri

String

Description

Parses uri and constructs either matching URI scheme object (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic.

Usage

p = URI::Parser.new
p.parse("ldap://ldap.example.com/dc=example?user=john")
#=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>

Args

uri

String

Description

Parses uri and constructs either matching URI scheme object (File, FTP, HTTP, HTTPS, LDAP, LDAPS, or MailTo) or URI::Generic.

Usage

p = URI::Parser.new
p.parse("ldap://ldap.example.com/dc=example?user=john")
#=> #<URI::LDAP ldap://ldap.example.com/dc=example?user=john>

Updates the database with multiple values from the specified object. Takes any object which implements the each_pair method, including Hash and DBM objects.

Returns self.

Returns true if stat terminated because of an uncaught signal.

Returns the least significant eight bits of the return code of stat. Only available if exited? is true.

fork { }           #=> 26572
Process.wait       #=> 26572
$?.exited?         #=> true
$?.exitstatus      #=> 0

fork { exit 99 }   #=> 26573
Process.wait       #=> 26573
$?.exited?         #=> true
$?.exitstatus      #=> 99

Wakes up the first thread in line waiting for this lock.

Returns the length of the queue.

Returns the length of the queue.

Returns the replacement string.

ec = Encoding::Converter.new("euc-jp", "us-ascii")
p ec.replacement    #=> "?"

ec = Encoding::Converter.new("euc-jp", "utf-8")
p ec.replacement    #=> "\uFFFD"

Sets the replacement string.

ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace)
ec.replacement = "<undef>"
p ec.convert("a \u3042 b")      #=> "a <undef> b"

Parses the given string into an abstract syntax tree, returning the root node of that tree.

RubyVM::AbstractSyntaxTree.parse("x = 1 + 2")
# => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:9>

If keep_script_lines: true option is provided, the text of the parsed source is associated with nodes and is available via Node#script_lines.

If keep_tokens: true option is provided, Node#tokens are populated.

SyntaxError is raised if the given string is invalid syntax. To overwrite this behavior, error_tolerant: true can be provided. In this case, the parser will produce a tree where expressions with syntax errors would be represented by Node with type=:ERROR.

root = RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2")
# <internal:ast>:33:in `parse': syntax error, unexpected ';', expecting ')' (SyntaxError)
# x = 1; p(x; y=2
#           ^

root = RubyVM::AbstractSyntaxTree.parse("x = 1; p(x; y=2", error_tolerant: true)
# (SCOPE@1:0-1:15
#  tbl: [:x, :y]
#  args: nil
#  body: (BLOCK@1:0-1:15 (LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)) (ERROR@1:7-1:11) (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))))
root.children.last.children
# [(LASGN@1:0-1:5 :x (LIT@1:4-1:5 1)),
#  (ERROR@1:7-1:11),
#  (LASGN@1:12-1:15 :y (LIT@1:14-1:15 2))]

Note that parsing continues even after the errored expresion.

Escape only the tags of certain HTML elements in string.

Takes an element or elements or array of elements. Each element is specified by the name of the element, without angle brackets. This matches both the start and the end tag of that element. The attribute list of the open tag will also be escaped (for instance, the double-quotes surrounding attribute values).

print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
  # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"

print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
  # "<BR>&lt;A HREF=&quot;url&quot;&gt;&lt;/A&gt"

Undo escaping such as that done by CGI.escapeElement()

print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
  # "&lt;BR&gt;<A HREF="url"></A>"

print CGI.unescapeElement(
        CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
  # "&lt;BR&gt;<A HREF="url"></A>"

Updates the digest using a given string and returns self.

The update() method and the left-shift operator are overridden by each implementation subclass. (One should be an alias for the other)

Returns digest_obj.digest_length().

No documentation available

Construct a new class given a C:

Fiddle::Importer#struct and Fiddle::Importer#union wrap this functionality in an easy-to-use manner.

Examples:

require 'fiddle/struct'
require 'fiddle/cparser'

include Fiddle::CParser

types, members = parse_struct_signature(['int i','char c'])

MyStruct = Fiddle::CStructBuilder.create(Fiddle::CUnion, types, members)

MyStruct.malloc(Fiddle::RUBY_FREE) do |obj|
  ...
end

obj = MyStruct.malloc(Fiddle::RUBY_FREE)
begin
  ...
ensure
  obj.call_free
end

obj = MyStruct.malloc
begin
  ...
ensure
  Fiddle.free obj.to_ptr
end

Construct a new class given a C:

Fiddle::Importer#struct and Fiddle::Importer#union wrap this functionality in an easy-to-use manner.

Examples:

require 'fiddle/struct'
require 'fiddle/cparser'

include Fiddle::CParser

types, members = parse_struct_signature(['int i','char c'])

MyStruct = Fiddle::CStructBuilder.create(Fiddle::CUnion, types, members)

MyStruct.malloc(Fiddle::RUBY_FREE) do |obj|
  ...
end

obj = MyStruct.malloc(Fiddle::RUBY_FREE)
begin
  ...
ensure
  obj.call_free
end

obj = MyStruct.malloc
begin
  ...
ensure
  Fiddle.free obj.to_ptr
end

See IO#getpass.

Similar to read, but raises EOFError at end of string instead of returning nil, as well as IO#sysread does.

Reads at most maxlen bytes from the stream. If buf is provided it must reference a string which will receive the data.

See IO#readpartial for full details.

Search took: 7ms  ·  Total Results: 2267