Results for: "tally"

SyntaxSuggest.valid? [Private]

Returns truthy if a given input source is valid syntax

SyntaxSuggest.valid?(<<~EOM) # => true
  def foo
  end
EOM

SyntaxSuggest.valid?(<<~EOM) # => false
  def foo
    def bar # Syntax error here
  end
EOM

You can also pass in an array of lines and they’ll be joined before evaluating

SyntaxSuggest.valid?(
  [
    "def foo\n",
    "end\n"
  ]
) # => true

SyntaxSuggest.valid?(
  [
    "def foo\n",
    "  def bar\n", # Syntax error here
    "end\n"
  ]
) # => false

As an FYI the CodeLine class instances respond to ‘to_s` so passing a CodeLine in as an object or as an array will convert it to it’s code representation.

Returns the arc tangent of y and x in radians.

Examples:

atan2(-1.0, -1.0) # => -2.356194490192345  # -3*PI/4
atan2(-1.0, 0.0)  # => -1.5707963267948966 # -PI/2
atan2(-1.0, 1.0)  # => -0.7853981633974483 # -PI/4
atan2(0.0, -1.0)  # => 3.141592653589793   # PI

Returns the tangent of x in radians.

Examples:

tan(-PI)   # => 1.2246467991473532e-16  # -0.0000000000000001
tan(-PI/2) # => -1.633123935319537e+16  # -16331239353195370.0
tan(0.0)   # => 0.0
tan(PI/2)  # => 1.633123935319537e+16   # 16331239353195370.0
tan(PI)    # => -1.2246467991473532e-16 # -0.0000000000000001

Returns the arc tangent of x.

Examples:

atan(-INFINITY) # => -1.5707963267948966 # -PI2
atan(-PI)       # => -1.2626272556789115
atan(-PI/2)     # => -1.0038848218538872
atan(0.0)       # => 0.0
atan(PI/2)      # => 1.0038848218538872
atan(PI)        # => 1.2626272556789115
atan(INFINITY)  # => 1.5707963267948966  # PI/2

Returns the hyperbolic tangent of x in radians.

Examples:

tanh(-INFINITY) # => -1.0
tanh(0.0)       # => 0.0
tanh(INFINITY)  # => 1.0

Returns the inverse hyperbolic tangent of x.

Examples:

atanh(-1.0) # => -Infinity
atanh(0.0)  # => 0.0
atanh(1.0)  # => Infinity

Sends a signal to each process specified by ids (which must specify at least one ID); returns the count of signals sent.

For each given id, if id is:

Argument signal specifies the signal to be sent; the argument may be:

If signal is:

Use method Signal.list to see which signals are supported by Ruby on the underlying platform; the method returns a hash of the string names and non-negative integer values of the supported signals. The size and content of the returned hash varies widely among platforms.

Additionally, signal 0 is useful to determine if the process exists.

Example:

pid = fork do
  Signal.trap('HUP') { puts 'Ouch!'; exit }
  # ... do some work ...
end
# ...
Process.kill('HUP', pid)
Process.wait

Output:

Ouch!

Exceptions:

In the last two cases, signals may have been sent to some processes.

Avoids the potential for a child process to become a zombie process. Process.detach prevents this by setting up a separate Ruby thread whose sole job is to reap the status of the process pid when it terminates.

This method is needed only when the parent process will never wait for the child process.

This example does not reap the second child process; that process appears as a zombie in the process status (ps) output:

pid = Process.spawn('ruby', '-e', 'exit 13') # => 312691
sleep(1)
# Find zombies.
system("ps -ho pid,state -p #{pid}")

Output:

312716 Z

This example also does not reap the second child process, but it does detach the process so that it does not become a zombie:

pid = Process.spawn('ruby', '-e', 'exit 13') # => 313213
thread = Process.detach(pid)
sleep(1)
# => #<Process::Waiter:0x00007f038f48b838 run>
system("ps -ho pid,state -p #{pid}")        # Finds no zombies.

The waiting thread can return the pid of the detached child process:

thread.join.pid                       # => 313262
No documentation available

Example:

x.foo
 ^^^^
x.foo(42)
 ^^^^
x&.foo
 ^^^^^
x[42]
 ^^^^
x += 1
  ^

Example:

x.foo(42)
      ^^
x[42]
  ^^
x += 1
     ^

Example:

x + 1
  ^
+x
^

Example:

x + 1
    ^

Example:

foo(42)
^^^
foo 42
^^^

Example:

foo(42)
    ^^
foo 42
    ^^

Compile a ConstantTargetNode node

Dispatch enter and leave events for ConstantTargetNode nodes and continue walking the tree.

Inspect a ConstantTargetNode node.

Copy a ConstantTargetNode node

Get all gem names from the command line.

Returns every spec that matches name and optional requirements.

Activate TLS_FALLBACK_SCSV for this context. See RFC 7507.

No documentation available

foo ^^^

foo.bar ^^^^^^^

foo.bar() {} ^^^^^^^^^^^^

Visit one side of an alias global variable node.

Search took: 5ms  ·  Total Results: 1835