るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

クラス

検索結果

<< < ... 6 7 8 9 10 ... > >>

Thread::Backtrace::Location#base_label -> String (220.0)

self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。

...を返します。通常、
Thread::Backtrace::Location#label から修飾を取り除いたもので構成
されます。

//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 |ca...

Thread::Backtrace::Location#inspect -> String (220.0)

Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。

...ce::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。

//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 |c...

Thread::Backtrace::Location#to_s -> String (220.0)

self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。

...self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。

//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.to_s
end...

Time#to_json(*args) -> String (220.0)

自身を JSON 形式の文字列に変換して返します。

...す。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

//emlist[例][ruby]{
require "json/add/core"

Time.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\":676167000}"
//}

@see JSON::Generator::GeneratorMethods::Hash#to_json...

Object#===(other) -> bool (197.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...[][ruby]{
age = 12
# (0..2).===(12), (3..6).===(12), ... が実行される
result =
case age
when 0 .. 2
"baby"
when 3 .. 6
"little child"
when 7 .. 12
"child"
when 13 .. 18
"youth"
else
"adult"
end

puts result #=> "child"

def check arg
case arg
when /ruby(?!...
...ls)/i
"hit! #{arg}"
when String
"Instance of String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==...

絞り込み条件を変える

Module#autoload(const_name, feature) -> nil (191.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...る対象を置き換えます。
const_name が(autoloadではなく)既に定義されているときは何もしません。

@param const_name String または Symbol で指定します。
なお、const_name には、"::" 演算子を含めることはできません。
つまり...
...ruby]{
# ------- /tmp/foo.rb ---------
class
Foo
class
Bar
end
end
# ----- end of /tmp/foo.rb ----

class
Foo
autoload :Bar, '/tmp/foo'
end
p Foo::Bar #=> Foo::Bar
//}

以下のようにモジュールを明示的にレシーバとして呼び出すこともできます。

//emlist[例][ruby...
...]{
# ------- /tmp/foo.rb ---------
class
Foo
class
Bar
end
end
# ----- end of /tmp/foo.rb ----

class
Foo
end
Foo.autoload :Bar, '/tmp/foo'
p Foo::Bar #=> Foo::Bar
//}

以下のように、autoload したライブラリがネストした定数を定義しない場
合、NameError が発生し...

OptionParser#on(long, pat = /.*/, desc = "") {|v| ...} -> self (186.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...外 OptionParser::InvalidArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定しま...

OptionParser#on(short, long, pat = /.*/, desc = "") {|v| ...} -> self (186.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...外 OptionParser::InvalidArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定しま...

OptionParser#on(short, pat = /.*/, desc = "") {|v| ...} -> self (186.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...外 OptionParser::InvalidArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定しま...

OptionParser#on(long, *rest) {|v| ...} -> self (181.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...説明と見なします。

//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http

opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}...

絞り込み条件を変える

<< < ... 6 7 8 9 10 ... > >>