Results for: "gsub"

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

Performs the specified substring replacement(s) on self; returns self if any replacement occurred, nil otherwise.

See Substitution Methods.

Returns an Enumerator if no replacement and no block given.

Related: String#sub, String#gsub, String#sub!.

Returns a copy of self with only the first occurrence (not all occurrences) of the given pattern replaced.

See Substitution Methods.

Related: String#sub!, String#gsub, String#gsub!.

Replaces the first occurrence (not all occurrences) of the given pattern on self; returns self if a replacement occurred, nil otherwise.

See Substitution Methods.

Related: String#sub, String#gsub, String#gsub!.

Returns the exact subseconds for self as a Numeric (Integer or Rational):

t = Time.now # => 2022-07-11 15:11:36.8490302 -0500
t.subsec     # => (4245151/5000000)

If the subseconds is zero, returns integer zero:

t = Time.new(2000, 1, 1, 2, 3, 4) # => 2000-01-01 02:03:04 -0600
t.subsec                          # => 0

Returns true if the set is a subset of the given set.

Deletes every element that appears in the given enumerable object and returns self.

Returns an array of classes where the receiver is the direct superclass of the class, excluding singleton classes. The order of the returned array is not defined.

class A; end
class B < A; end
class C < B; end
class D < A; end

A.subclasses        #=> [D, B]
B.subclasses        #=> [C]
C.subclasses        #=> []

Anonymous subclasses (not associated with a constant) are returned, too:

c = Class.new(A)
A.subclasses        # => [#<Class:0x00007f003c77bd78>, D, B]

Note that the parent does not hold references to subclasses and doesn’t prevent them from being garbage collected. This means that the subclass might disappear when all references to it are dropped:

# drop the reference to subclass, it can be garbage-collected now
c = nil

A.subclasses
# It can be
#  => [#<Class:0x00007f003c77bd78>, D, B]
# ...or just
#  => [D, B]
# ...depending on whether garbage collector was run

Return a pathname which is substituted by String#sub.

path1 = Pathname.new('/usr/bin/perl')
path1.sub('perl', 'ruby')
    #=> #<Pathname:/usr/bin/ruby>

Equivalent to $_.sub(args), except that $_ will be updated if substitution occurs. Available only when -p/-n command line option specified.

Quietly ensure the Gem directory dir contains all the proper subdirectories. If we can’t create a directory due to a permission problem, then we will silently continue.

If mode is given, missing directories are created with this mode.

World-writable directories will never be created.

Quietly ensure the Gem directory dir contains all the proper subdirectories for handling default gems. If we can’t create a directory due to a permission problem, then we will silently continue.

If mode is given, missing directories are created with this mode.

World-writable directories will never be created.

Returns true if the set is a proper subset of the given set.

Return a pathname with repl added as a suffix to the basename.

If self has no extension part, repl is appended.

Pathname.new('/usr/bin/shutdown').sub_ext('.rb')
    #=> #<Pathname:/usr/bin/shutdown.rb>

Takes a block and queues a new group that is indented 1 level further.

Generate a submit button Input element, as a String.

value is the text to display on the button. name is the name of the input.

Alternatively, the attributes can be specified as a hash.

submit
  # <INPUT TYPE="submit">

submit("ok")
  # <INPUT TYPE="submit" VALUE="ok">

submit("ok", "button1")
  # <INPUT TYPE="submit" VALUE="ok" NAME="button1">

submit("VALUE" => "ok", "NAME" => "button1", "ID" => "foo")
  # <INPUT TYPE="submit" VALUE="ok" NAME="button1" ID="foo">
No documentation available

Returns the trailing (‘subtype’) part of the media type from the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

res = Net::HTTP.get_response(hostname, '/todos/1')
res['content-type'] # => "application/json; charset=utf-8"
res.sub_type        # => "json"
No documentation available
No documentation available
No documentation available
No documentation available
Search took: 4ms  ·  Total Results: 347