るりまサーチ

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

別のキーワード

  1. _builtin main
  2. main define_method
  3. main public
  4. main private
  5. main to_s

ライブラリ

クラス

オブジェクト

キーワード

検索結果

<< < 1 2 3 4 > >>

Socket.gethostbyname(host) -> Array (19.0)

ホスト名または IP アドレス(指定方法に関しては lib:socket#host_formatを参照) からホストの情報を返します。

....unpack_sockaddr_in で unpack できます。

=== 使用例

irb(main):009:0> require 'socket'

irb(main):009:0> Socket.gethostbyname("210.251.121.214")
["helium.ruby-lang.org", ["helium"], 2, "\322\373y\326"]

irb(main):009:0> Socket.unpack_sockaddr_in(Socket.gethostbyname("210.251.121....

Data.define(*args) -> Class (7.0)

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

...ます。

//emlist[例][ruby]{
Customer = Data.define(:name, :address) do
def greeting
"Hello #{name}!"
end
end
p Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

なお、Dataのサブクラスのインスタンスを生成する際にオプション引数を使用した...

Data.define(*args) {|subclass| block } -> Class (7.0)

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

...ます。

//emlist[例][ruby]{
Customer = Data.define(:name, :address) do
def greeting
"Hello #{name}!"
end
end
p Customer.new("Dave", "123 Main").greeting # => "Hello Dave!"
//}

なお、Dataのサブクラスのインスタンスを生成する際にオプション引数を使用した...

Dir.[](*pattern, base: nil) -> [String] (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

Dir.[](*pattern, base: nil, sort: true) -> [String] (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

絞り込み条件を変える

Dir.glob(pattern, flags = 0, base: nil) -> [String] (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

Dir.glob(pattern, flags = 0, base: nil) {|file| ...} -> nil (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

Dir.glob(pattern, flags = 0, base: nil, sort: true) -> [String] (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

Dir.glob(pattern, flags = 0, base: nil, sort: true) {|file| ...} -> nil (7.0)

ワイルドカードの展開を行い、 パターンにマッチするファイル名を文字列の配列として返します。 パターンにマッチするファイルがない場合は空の配列を返します。

..."{b,f}*") #=> ["bar", "foo"]

# ベースディレクトリの例
rbfiles = File.join("**", "*.rb")
Dir.glob(rbfiles) #=> ["main.rb",
# "lib/song.rb",
# "lib/song/karaoke.rb"]
Dir.glob(rbfiles, base...

IRB::Inspector.def_inspector(key, arg = nil) { |v| ... } -> object (7.0)

新しい実行結果の出力方式を定義します。

...ロックを指定しない場合には、実行結果の出力のための手続きオ
ブジェクトを指定します。

例.

# .irbrc
IRB::Inspector.def_inspector([:test]){ |v| v.to_s * 2 }

$ irb --inspect test
irb(main):001:0> :abc # => abcabc

@see lib:irb#inspect_mode...

絞り込み条件を変える

Proc.new -> Proc (7.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...

Proc.new { ... } -> Proc (7.0)

ブロックをコンテキストとともにオブジェクト化して返します。

...Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}

Proc.new は、Proc#initialize が定義されていれば
オブジェクトの初期化のためにこれを呼び出します。このこ...

RubyVM::InstructionSequence.compile_file(file, options = nil) -> RubyVM::InstructionSequence (7.0)

引数 file で指定した Ruby のソースコードを元にコンパイル済みの RubyVM::InstructionSequence オブジェクトを作成して返します。

...yVM::InstructionSequence.compile_option= を参照
してください。

# /tmp/hello.rb
puts "Hello, world!"

# irb
RubyVM::InstructionSequence.compile_file("/tmp/hello.rb")
# => <RubyVM::InstructionSequence:<main>@/tmp/hello.rb>

@see RubyVM::InstructionSequence.compile...

RubyVM::InstructionSequence.disasm(body) -> String (7.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

.../tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequence.disasm(p)

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 c...

RubyVM::InstructionSequence.disassemble(body) -> String (7.0)

引数 body で指定したオブジェクトから作成した RubyVM::InstructionSequence オブジェクトを人間が読める形式の文字 列に変換して返します。

.../tmp/proc.rb
p = proc { num = 1 + 2 }
puts RubyVM::InstructionSequence.disasm(p)

出力:

== disasm: <RubyVM::InstructionSequence:block in <main>@/tmp/proc.rb>===
== catch table
| catch type: redo st: 0000 ed: 0012 sp: 0000 cont: 0000
| catch type: next st: 0000 ed: 0012 sp: 0000 c...

絞り込み条件を変える

<< < 1 2 3 4 > >>