るりまサーチ

最速Rubyリファレンスマニュアル検索!
262件ヒット [1-100件を表示] (0.068秒)
トップページ > クエリ:nil[x] > クエリ:end[x] > クエリ:to_s[x]

別のキーワード

  1. _builtin end
  2. ripper end_seen?
  3. _builtin exclude_end?
  4. _builtin end_with?
  5. zlib end

検索結果

<< 1 2 3 > >>

Method#to_s -> String (15179.0)

self を読みやすい文字列として返します。

...oo.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) # => #<Method: Bar(Foo)#foo() test.rb:2>
p...
...ef foo
end

end

p obj.method(:foo) # => #<Method: "".foo() foo.rb:4>

# クラスメソッド(クラスの特異メソッド)
class Foo
def Foo.foo
end

end

p Foo.method(:foo) # => #<Method: Foo.foo() foo.rb:11>

# スーパークラスのクラスメソッド
class Bar < Foo
end

p Bar...
....method(:foo) # => #<Method: Bar(Foo).foo() foo.rb:11>

# 以下は(形式1)の出力になる
module Baz
def baz
end

end


class <<obj
include Baz
end

p obj.method(:baz) # => #<Method: String(Baz)#baz() foo.rb:23>
//}

@see Object#inspect...

Module#to_s -> String (15150.0)

モジュールやクラスの名前を文字列で返します。

...前のないモジュール / クラスに対しては、name は nil を、それ以外はオブジェクト ID の文字列を返します。

//emlist[例][ruby]{
module A
module B
end


p B.name #=> "A::B"

class C
end

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>"
//}...

Exception#to_s -> String (15119.0)

エラーメッセージをあらわす文字列を返します。

...エラーメッセージをあらわす文字列を返します。

//emlist[例][ruby]{
begin
1 + nil
rescue => e
p e.message #=> "nil can't be coerced into Fixnum"
end

//}...

Pathname#opendir {|dir| ... } -> nil (6217.0)

Dir.open(self.to_s, &block) と同じです。

...Dir.open(self.to_s, &block) と同じです。


@see Dir.open...

Pathname#opendir -> Dir (6117.0)

Dir.open(self.to_s, &block) と同じです。

...Dir.open(self.to_s, &block) と同じです。


@see Dir.open...

絞り込み条件を変える

1.6.8から1.8.0への変更点(まとめ) (1302.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...りました。
* nil: 警告を出力しない (-W0 新しい警告レベル)
* false: 重要な警告のみ出力 (-W1 デフォルト)
* true: すべての警告を出力する (-W2 or -W or -v or -w or --verbose)

追加された -W オプションは $VERBOSE = nil の指定(-W0)を...
...よくわかりません(^^;

class << Object
p [self.id, self]
class << self
p [self.id, self]
end

end

=> ruby 1.6.7 (2002-03-01) [i586-linux]
[537771634, Class]
[537742484, Class]
=> ruby 1.7.3 (2002-09...
...yield の戻り値になります。

: to_str [compat]

to_s
tr を定義したオブジェクトはより広範囲にStringとして振舞うように
なりました。

文字列を引数に取るほとんどの組み込みメソッドは、to_str による暗黙の
型変換を試...

ruby 1.6 feature (570.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

... nil
を返すようになりました。(String#[]やString#slice と同じ結果を返すと
いうことです)

p "foo".slice!("bar") # <- 以前からこちらは nil を返していた
p "foo".slice!(5,10)

=> ruby 1.6.7 (2002-03-01) [i586-linux]
nil
...
...ーになっていました。
((<ruby-dev:17155>))

open("|-","r+") {|f|
if f
f.dup.close_write
else
sleep 1
end

}

=> ruby 1.6.7 (2002-03-01) [i586-linux]
-:3:in `close_write': closing non-duplex IO for writing (IOError)
from -:3...
...まり、名前解
決中にThreadが切替え可能ということです)

require 'resolv'
p Resolv.new.getaddress("www.ruby-lang.org").to_s

=> /usr/local/lib/ruby/1.6/resolv.rb:160: warning: timeout (...) interpreted as method call
/usr/local/lib/ruby/1.6/resolv.rb:55: warni...

rss (444.0)

RSS を扱うためのライブラリです。

...RSS を扱うためのライブラリです。

=== 参考

* RSS 0.91 http://backend.userland.com/rss091
* RSS 1.0 http://purl.org/rss/1.0/spec
* RSS 2.0 http://www.rssboard.org/rss-specification
* Atom 1.0 https://www.ietf.org/rfc/rfc4287.txt

=== 注意

RSS ParserはRSS 0.9x/1.0/2.0, A...
...は,
例外 RSS::NotWellFormedError が発生します。well formed な
XML だが,RSS 0.9x/1.0/2.0, Atom のいずれでもない場合は,nil
返ります.

例えば、RSS 1.0 をバリデーション付きでパースするには以下のよ
うにします。ここで、変数 rss_...
...い.

=== 出力

RSS Parserといっているので誤解されがちですが,RSS/Atomを出力する
こともできます.

==== 基本

to_s
するとRSSまたはAtom形式の文字列を返します.

RSS/Atomを出力する流れは以下のようになります.

* RSS/Atomオブ...

Kernel.#warn(*message, uplevel: nil, category: nil) -> nil (355.0)

message を 標準エラー出力 $stderr に出力します。 $VERBOSE フラグ が nil のときは何も出力しません。

...sage を 標準エラー出力 $stderr に出力します。 $VERBOSE
フラグ が nil のときは何も出力しません。

文字列以外のオブジェクトが引数として与えられた場合には、
to_s
メソッドにより文字列に変換してから出力します。

uplevel...
...uts(*message) if !$VERBOSE.nil? && !message.empty?
nil

//}

@param message 出力するオブジェクトを任意個指定します。
@param uplevel いくつ前の呼び出し元のファイル名と行番号を表示するかを0以上の数値で指定します。 nil の場合は表示しま...
...RBOSE = nil
warn "caution!" # 何もしない
//}

//emlist[uplevel の例][ruby]{
def foo
warn("test message", uplevel: 0) # => test.rb:2: warning: test message
warn("test message", uplevel: 1) # => test.rb:6: warning: test message
warn("test message", uplevel: 2) # => test message
end

foo
//...

NEWS for Ruby 2.7.0 (348.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...p b #=> 1
p c #=> [2, 3]
end

//}

//emlist[][ruby]{
case {a: 0, b: 1}
in {a: 0, x: 1}
:unreachable
in {a: 0, b: var}
p var #=> 1
end

//}

//emlist[][ruby]{
case -1
in 0 then :unreachable
in 1 then :unreachable
end
#=> NoMatchingPatternError
//}

//emlist{
json = <<END
{
"name": "Alice",
"a...
...ましたが、
再び許容されるようになりました。 15658

//emlist[][ruby]{
def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1}
//}

* メソッド定義で**nilと書くことで、このメソッドがキーワードを
受け取らないことを明示できるよう...
...Numbered parameters)がデフォルトのブロックの仮引数として
導入されました。 4475

//emlist[][ruby]{
[1, 2, 10].map { _1.to_s(16) } #=> ["1", "2", "a"]
[[1, 2], [3, 4]].map { _1 + _2 } #=> [3, 7]
//}

* 「_1」などはまだローカル変数名として使えて...

絞り込み条件を変える

Kernel.#warn(*message, uplevel: nil) -> nil (254.0)

message を 標準エラー出力 $stderr に出力します。 $VERBOSE フラグ が nil のときは何も出力しません。

...sage を 標準エラー出力 $stderr に出力します。 $VERBOSE
フラグ が nil のときは何も出力しません。

文字列以外のオブジェクトが引数として与えられた場合には、
to_s
メソッドにより文字列に変換してから出力します。

uplevel...
...uts(*message) if !$VERBOSE.nil? && !message.empty?
nil

//}

@param message 出力するオブジェクトを任意個指定します。
@param uplevel いくつ前の呼び出し元のファイル名と行番号を表示するかを0以上の数値で指定します。 nil の場合は表示しま...
...RBOSE = nil
warn "caution!" # 何もしない
//}

//emlist[uplevel の例][ruby]{
def foo
warn("test message", uplevel: 0) # => test.rb:2: warning: test message
warn("test message", uplevel: 1) # => test.rb:6: warning: test message
warn("test message", uplevel: 2) # => test message
end

foo
//...

irb (222.0)

irb は Interactive Ruby の略です。 irb を使うと、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> end
:foo
irb(main):007:0>

また irb コマンドは readline ライブラリにも対応しています。
readline ライブラリ...
...nf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:MATH_MODE] = false
IRB.c...
...な記法は以下の通りです。

: %N
起動しているコマンド名(IRB::Context#irb_name)
: %m
main オブジェクト (self) を to_s した文字列
: %M
main オブジェクト (self) を inspect した文字列
: %l
文字列中のタイプを表す (", ', /, ], `]'は%...
...nf[:DEBUG_LEVEL] = 1
IRB.conf[:ECHO] = nil
IRB.conf[:EVAL_HISTORY] = nil
IRB.conf[:HISTORY_FILE] = nil
IRB.conf[:IGNORE_EOF] = true
IRB.conf[:IGNORE_SIGINT] = true
IRB.conf[:INSPECT_MODE] = nil
IRB.conf[:IRB_NAME] = "irb"
IRB.conf[:IRB_RC] = nil
IRB.conf[:PROMPT] = {....}
IRB.con...
<< 1 2 3 > >>