るりまサーチ

最速Rubyリファレンスマニュアル検索!
164件ヒット [1-100件を表示] (0.031秒)

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self

検索結果

<< 1 2 > >>

Complex#abs -> Numeric (18137.0)

自身の絶対値を返します。

...す。

以下の計算の結果を Float オブジェクトで返します。

sqrt(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
//}

@see Complex#abs2...

Integer#abs -> Integer (18135.0)

self の絶対値を返します。

...
self
の絶対値を返します。

//emlist[][ruby]{
-12345.abs # => 12345
12345.abs # => 12345
-1234567890987654321.abs # => 1234567890987654321
//}...

BigDecimal#abs -> BigDecimal (18129.0)

self の絶対値を返します。

...
self
の絶対値を返します。

//emlist[][ruby]{
require 'bigdecimal'
BigDecimal('5').abs.to_i # => 5
BigDecimal('-3').abs.to_i # => 3
//}...

Bignum#abs -> Fixnum | Bignum (18117.0)

self の絶対値を返します。

...
self
の絶対値を返します。...

Fixnum#abs -> Fixnum | Bignum (18117.0)

self の絶対値を返します。

...
self
の絶対値を返します。...

絞り込み条件を変える

Complex#abs2 -> Numeric (6137.0)

自身の絶対値の 2 乗を返します。

...自身の絶対値の 2 乗を返します。

以下の計算の結果を返します。

self
.real ** 2 + self.imag ** 2

//emlist[例][ruby]{
Complex(1, 1).abs2 # => 2
Complex(1.0, 1.0).abs2 # => 2.0
Complex('1/2', '1/2').abs2 # => (1/2)
//}

@see Complex#abs...

RubyVM::InstructionSequence#absolute_path -> String | nil (6122.0)

self が表す命令シーケンスの絶対パスを返します。

...
self
が表す命令シーケンスの絶対パスを返します。

self
を文字列から作成していた場合は nil を返します。

例1:irb で実行した場合

iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
i...
...seq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@see RubyVM::I...

Pathname#absolute? -> bool (6116.0)

self が絶対パス指定であれば真を返します。

...self が絶対パス指定であれば真を返します。

//emlist[例][ruby]{
require "pathname"

pathname = Pathname("/path/to/example.rb")
pathname.absolute? # => true
pathname = Pathname("../")
pathname.absolute? # => false
//}...

Thread::Backtrace::Location#absolute_path -> String (6116.0)

self が表すフレームの絶対パスを返します。

...
self
が表すフレームの絶対パスを返します。

//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end

Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end

# => /path/to/foo.rb
# /path...

Complex#magnitude -> Numeric (3037.0)

自身の絶対値を返します。

...す。

以下の計算の結果を Float オブジェクトで返します。

sqrt(self.real ** 2 + self.imag ** 2)

//emlist[例][ruby]{
Complex(1, 2).abs # => 2.23606797749979
Complex(3, 4).abs # => 5.0
Complex('1/2', '1/2').abs # => 0.7071067811865476
//}

@see Complex#abs2...

絞り込み条件を変える

Integer#magnitude -> Integer (3035.0)

self の絶対値を返します。

...
self
の絶対値を返します。

//emlist[][ruby]{
-12345.abs # => 12345
12345.abs # => 12345
-1234567890987654321.abs # => 1234567890987654321
//}...
<< 1 2 > >>