るりまサーチ

最速Rubyリファレンスマニュアル検索!
66件ヒット [1-66件を表示] (0.080秒)
トップページ > クエリ:i[x] > クエリ:LITERAL[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. matrix i
  5. csv to_i

クラス

モジュール

キーワード

検索結果

RubyVM::InstructionSequence.compile_option -> Hash (6114.0)

命令シーケンスのコンパイル時のデフォルトの最適化オプションを Hash で返 します。

...//emlist[例][ruby]{
require "pp"
pp RubyVM::InstructionSequence.compile_option

# => {:inline_const_cache=>true,
# :peephole_optimization=>true,
# :tailcall_optimization=>false,
# :specialized_instruction=>true,
# :operands_unification=>true,
# :instructions_unification=>false,
# :stack_caching=>f...
...alse,
# :trace_instruction=>true,
# :frozen_string_literal=>false,
# :debug_frozen_string_literal=>false,
# :coverage_enabled=>true,
# :debug_level=>0}
//}

@see RubyVM::InstructionSequence.compile_option=...

BasicObject#__id__ -> Integer (6108.0)

各オブジェクトに対して一意な整数を返します。あるオブジェクトに対し てどのような整数が割り当てられるかは不定です。

...t#object_id と同じですが、#object_id は BasicObject に
はない事に注意してください。

//emlist[例][ruby]{
# frozen_string_literal: false
obj = Object.new
obj.object_id == obj.__id__ # => true
Object.new.__id__ == Object.new.__id__ # => false
(21 * 2).__id__ =...
...= (21 * 2).__id__ # => true
"hello".__id__ == "hello".__id__ # => false
"hi".freeze.__id__ == "hi".freeze.__id__ # => true
//}

@see Object#object_id, 42840...

String#+@ -> String | self (3108.0)

self が freeze されている文字列の場合、元の文字列の複製を返します。 freeze されていない場合は self を返します。

...ist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
unfrozen_text = +original_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => true

original_text = "text".freeze
unfrozen_text = +origi...
...nal_text
unfrozen_text.frozen? # => false
original_text == unfrozen_text # => true
original_text.equal?(unfrozen_text) # => false
//}

@see String#-@...

String#-@ -> String | self (3108.0)

self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。

...//emlist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false

original_text = "text".freeze
frozen_text = -original_t...
...ext
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}

@see String#+@...

String#dedup -> String | self (3108.0)

self が freeze されている文字列の場合、self を返します。 freeze されていない場合は元の文字列の freeze された (できる限り既存の) 複製を返します。

...//emlist[例][ruby]{
# frozen_string_literal: false

original_text = "text"
frozen_text = -original_text
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => false

original_text = "text".freeze
frozen_text = -original_t...
...ext
frozen_text.frozen? # => true
original_text == frozen_text # => true
original_text.equal?(frozen_text) # => true
//}

@see String#+@...

絞り込み条件を変える

Kernel.#`(command) -> String (114.0)

command を外部コマンドとして実行し、その標準出力を文字列として 返します。このメソッドは `command` の形式で呼ばれます。

...けなら
Kernel.#system を使います。特に端末を制御するコマンドでは
`command` は失敗するかもしれません。

d:spec/literal#command も参照。

@param command コマンドとして実行する引数です。そのまま評価されるのではなく、
ダブ...
...字列で返します。
@raise Errno::EXXX コマンドを実行できないときや失敗した場合に発生します。

//emlist[例][ruby]{
puts `ruby -v` #=> ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
puts $?.inspect #=> #<Process::Status: pid=3580,exited(0)>
//}

@see Kernel.#syst...

Regexp#~ -> Integer | nil (108.0)

変数 $_ の値との間でのマッチをとります。

...ist[][ruby]{
self =~ $_
//}

//emlist[例][ruby]{
$_ = "hogehoge"

i
f /foo/
puts "match"
else
puts "no match"
end
# => no match
# ただし、警告がでる。warning: regex literal in condition

reg = Regexp.compile("foo")

i
f ~ reg
puts "match"
else
puts "no match"
end
# => no match

i
...
...f reg
puts "match"
else
puts "no match"
end
# => match
# reg は nil でも false でも無いので常にtrue
//}...

Struct.new(*args, keyword_init: nil) -> Class (108.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String を...
...名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義します。
Rub...
...ください。

//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) #...

Struct.new(*args, keyword_init: nil) {|subclass| block } -> Class (108.0)

Struct クラスに新しいサブクラスを作って、それを返します。

...//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}

実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String を...
...名は Symbol で指定するのが無難です。

@param args 構造体を定義するための可変長引数。String または Symbol を指定します。
@param keyword_init true を指定すると、キーワード引数で初期化する構造体を定義します。
Rub...
...ください。

//emlist[例][ruby]{
Point = Struct.new(:x, :y, keyword_init: true) # => Point(keyword_init: true)
Point.new(x: 1, y: 2) # => #<struct Point x=1, y=2>
Point.new(x: 1) # => #<struct Point x=1, y=nil>
Point.new(y: 2) # => #<struct Point x=nil, y=2>
Point.new(z: 3) #...