るりまサーチ

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

別のキーワード

  1. _builtin abs
  2. _builtin abs2
  3. bigdecimal abs
  4. float abs
  5. integer abs

検索結果

Complex#abs -> Numeric (18134.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...

Complex#abs2 -> Numeric (6134.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...

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

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

...][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/to/foo.rb
# /path/to/foo.rb
//}

@
see Thread::Backtrace::Location#path...

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

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

...uence:<compiled>@<compiled>>
iseq.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::InstructionSequence#path...

Complex#magnitude -> Numeric (3034.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...

絞り込み条件を変える

RubyVM::AbstractSyntaxTree::Node#children -> Array (3009.0)

self の子ノードを配列で返します。

...type によって異なります。

戻り値は、ほかの RubyVM::AbstractSyntaxTree::Node のインスタンスや nil を含みます。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 2')
p node.children
# => [[], nil, #<RubyVM::AbstractSyntaxTree::Node:OPCALL@1:0-1:5>]
//}...

RubyVM::AbstractSyntaxTree::Node#inspect -> String (3009.0)

self のデバッグ用の情報を含んだ文字列を返します。

...self のデバッグ用の情報を含んだ文字列を返します。

//emlist[][ruby]{
node = RubyVM::AbstractSyntaxTree.parse('1 + 1')
puts node.inspect
# => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-1:5>
//}...

Object#method(name) -> Method (33.0)

オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。

...ます。

@
param name メソッド名をSymbol またはStringで指定します。
@
raise NameError 定義されていないメソッド名を引数として与えると発生します。

//emlist[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#abs>
p me.call #=> 365
//}

@
see Module#i...

Object#send(name, *args) -> object (27.0)

オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。

...場合は
Object#public_send を使う方が良いでしょう。

@
param name 文字列かSymbol で指定するメソッド名です。
@
param args 呼び出すメソッドに渡す引数です。

//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"


class Foo
def...
...ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}

@
see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method...

Object#send(name, *args) { .... } -> object (27.0)

オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。

...場合は
Object#public_send を使う方が良いでしょう。

@
param name 文字列かSymbol で指定するメソッド名です。
@
param args 呼び出すメソッドに渡す引数です。

//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"


class Foo
def...
...ーバは任意(Foo クラスのインスタンスである必要もない)
p Foo.new.send(methods[1]) # => "foo"
p Foo.new.send(methods[2]) # => "bar"
p Foo.new.send(methods[3]) # => "baz"
//}

@
see Object#public_send, BasicObject#__send__, Object#method, Kernel.#eval, Proc, Method...

絞り込み条件を変える