436件ヒット
[1-100件を表示]
(0.108秒)
ライブラリ
- English (11)
- ビルトイン (264)
- fiddle (11)
- json (11)
- monitor (11)
-
rexml
/ document (22) -
webrick
/ httpresponse (11) - win32ole (11)
クラス
-
ARGF
. class (33) - BasicObject (11)
- FalseClass (22)
- Method (22)
- Module (33)
- NilClass (11)
- Object (44)
-
REXML
:: CData (22) - Range (11)
- Thread (11)
-
Thread
:: Backtrace :: Location (22) - TrueClass (11)
-
WEBrick
:: HTTPResponse (11) -
WIN32OLE
_ EVENT (11)
モジュール
キーワード
-
$ ERROR _ INFO (11) -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Closure (11)
- Location (11)
- MonitorMixin (11)
-
NEWS for Ruby 2
. 0 . 0 (11) -
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Numeric (11)
- String (11)
-
define
_ singleton _ method (22) - handler= (11)
-
http
_ version (11) - inspect (55)
- irb (11)
-
irb
/ completion (11) -
method
_ missing (11) - name (11)
- new (11)
-
ruby 1
. 6 feature (11) -
set
_ trace _ func (11) -
to
_ json (11) -
to
_ str (11) - tracer (11)
- value (11)
- write (11)
- メソッド呼び出し(super・ブロック付き・yield) (9)
検索結果
先頭5件
-
irb (26114.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...irb は Interactive Ruby の略です。
irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
=== irb の使い方
Ruby さえ知っていれば irb を使うのは簡単です。
irb コマンドを実行すると、以下のようなプロン......。
$ irb
irb(main):001:0>
あとは Ruby の式を入力するだけで、その式が実行され、結果が表示されます。
irb(main):001:0> 1+2
3
irb(main):002:0> class Foo
irb(main):003:1> def foo
irb(main):004:2> print 1
irb(main):005:2> end
irb(main):006:1>......rnel.#printf のように
「%」を用いた記法が使えます。
フォーマット文字列で使用可能な記法は以下の通りです。
: %N
起動しているコマンド名(IRB::Context#irb_name)
: %m
main オブジェクト (self) を to_s した文字列
: %M
main オ... -
irb
/ completion (26012.0) -
irb の completion 機能を提供するライブラリです。
...irb の completion 機能を提供するライブラリです。
=== 使い方
$ irb -r irb/completion
とするか, ~/.irbrc 中に
require "irb/completion"
を入れてください.
irb実行中に require "irb/completion" してもよいです.
irb 実行中に [Tab] を押すとコ......lic_methods
foo.=~ foo.id foo.respond_to?
foo.__id__ foo.inspect foo.send
foo.__send__ foo.instance_eval foo.singleton_methods
foo.class foo.instance_of? foo.taint
foo.clone foo.i......_variables foo.tainted?
foo.display foo.is_a? foo.to_a
foo.dup foo.kind_of? foo.to_s
foo.eql? foo.method foo.type
foo.equal? foo.methods foo.untaint
foo.extend foo.nil?... -
NilClass
# to _ s -> String (24207.0) -
空文字列 "" を返します。
...空文字列 "" を返します。
//emlist[例][ruby]{
nil.to_s # => ""
//}... -
Thread
:: Backtrace :: Location # to _ s -> String (21213.0) -
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
# => path/to/foo.rb:5:in `initialize'
# path/to/foo.rb:9:in `new'
# path/to/foo.rb:9:in `<main>'
/... -
FalseClass
# to _ s -> String (21207.0) -
常に文字列 "false" を返します。
...常に文字列 "false" を返します。
//emlist[例][ruby]{
false.to_s # => "false"
//}... -
TrueClass
# to _ s -> String (21207.0) -
常に文字列 "true" を返します。
...常に文字列 "true" を返します。
//emlist[例][ruby]{
true.to_s # => "true"
//}... -
ARGF
. class # to _ s -> String (21201.0) -
常に文字列 "ARGF" を返します。
常に文字列 "ARGF" を返します。 -
Module
# to _ s -> String (18237.0) -
モジュールやクラスの名前を文字列で返します。
...「CGI::Session」「Net::HTTP」が挙げられます。
@return 名前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。
//emlist[例][ruby]{
module A
module B
end
p B.name #=> "A::B"
class C
e......nd
end
p A.name #=> "A"
p A::B.name #=> "A::B"
p A::C.name #=> "A::C"
# 名前のないモジュール / クラス
p Module.new.name #=> nil
p Class.new.name #=> nil
p Module.new.to_s #=> "#<Module:0x00007f90b09112c8>"
p Class.new.to_s #=> "#<Class:0x00007fa5c40b41b0>"
//}... -
Method
# to _ s -> String (18231.0) -
self を読みやすい文字列として返します。
...形式の文字列を返します。
#<Method: klass1(klass2)#method> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klas......ッドを定義しているクラス/モジュール名、
method は、メソッド名を表します。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end
p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar)......るオブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end
end
p Foo.method(:foo......式の文字列を返します。
#<Method: klass1(klass2)#method(arg) foo.rb:2> (形式1)
klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。
klass......arg は引数を表します。
「foo.rb:2」は Method#source_location を表します。
source_location が nil の場合には付きません。
//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar(a, b)
end
end
p Bar.new.method(:foo) # =>......ブジェクトになります。
//emlist[例][ruby]{
# オブジェクトの特異メソッド
obj = ""
class <<obj
def foo
end
end
p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>
# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end
end
p Foo.method... -
Object
# to _ s -> String (18231.0) -
オブジェクトの文字列表現を返します。
...rint や Kernel.#sprintf は文字列以外の
オブジェクトが引数に渡された場合このメソッドを使って文字列に変換し
ます。
//emlist[][ruby]{
class Foo
def initialize num
@num = num
end
end
it = Foo.new(40)
puts it #=> #<Foo:0x2b69110>
class Foo
def to_s......"Class:Foo Number:#{@num}"
end
end
puts it #=> Class:Foo Number:40
//}
@see Object#to_str,Kernel.#String...