種類
- インスタンスメソッド (36)
- 文書 (35)
- クラス (12)
- 特異メソッド (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Numeric (12)
- new (12)
- next (12)
-
ruby 1
. 6 feature (12)
検索結果
先頭5件
-
IPAddr
# succ -> IPAddr (18113.0) -
次の IPAddr オブジェクトを返します。
...次の IPAddr オブジェクトを返します。
require 'ipaddr'
ipaddr = IPAddr.new('192.168.1.1')
p ipaddr.succ.to_s #=> "192.168.1.2"... -
Symbol
# succ -> Symbol (15113.0) -
シンボルに対応する文字列の「次の」文字列に対応するシンボルを返します。
...シンボルに対応する文字列の「次の」文字列に対応するシンボルを返します。
(self.to_s.next.intern と同じです。)
:a.next # => :b
:foo.next # => :fop
@see String#succ... -
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (78.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への変更点(まとめ)/サポートプラットフォームの追加>))
...yield の戻り値になります。
: to_str [compat]
to_str を定義したオブジェクトはより広範囲にStringとして振舞うように
なりました。
文字列を引数に取るほとんどの組み込みメソッドは、to_str による暗黙の
型変換を試......: ((<Range#include?|Range/include?>)) [new]
: ((<Range#member?|Range/member?>)) [new]
追加
=== Regexp
: ((<Regexp#to_s|Regexp/to_s>)) [new]
追加。((<ruby-dev:16909>))
これにより、
re1 = /hogehoge/i
re2 = /fugafuga/
re3 = / #{re1} | #{re2} /......(1.8 では、max, min は、Enumerable のメソッドに戻っています)
: ((<Range#each|Range/each>)) [change]
Range#each は各要素の succ メソッドを使用してイテレーションするよう
になりました。
=== Regexp
: ((<Regexp/Regexp.new>)) [change]
第一引... -
NEWS for Ruby 2
. 7 . 0 (48.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...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」などはまだローカル変数名として使えて......た。 15323
* Enumerable#tallyが追加されました。 11076
//emlist[Enumerable#filter_map][ruby]{
[1, 2, 3].filter_map {|x| x.odd? ? x.to_s : nil } #=> ["1", "3"]
//}
//emlist[Enumerable#tally][ruby]{
["A", "B", "C", "B", "A"].tally #=> {"A"=>2, "B"=>2, "C"=>1}
//}
* Enumerator
*......ォルト実装から
lazyになりました。7877
//emlist[Enumerator.produce][ruby]{
require "date"
dates = Enumerator.produce(Date.today, &:succ) #=> infinite sequence of dates
dates.detect(&:tuesday?) #=> next Tuesday
//}
//emlist[Enumerator::Lazy#eager][ruby]{
a = %w(foo bar baz)
e = a.lazy.... -
ruby 1
. 6 feature (48.0) -
ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。
...5 (2001-11-01) [i586-linux]
1
2
: String#succ
((<ruby-talk:22557>))
p "***".succ
p "*".succ
p sprintf("%c", 255).succ
p sprintf("*%c", 255).succ
p sprintf("**%c", 255).succ
=> ruby 1.6.5 (2001-09-19) [i586-linux]
"*......p Foo.new("").class
p Foo.new("foo")[0,0].class # String ???
p Foo.new("foo")[1,1].class
p Foo.new("foo").succ.class
p Foo.new("foo").reverse.class
p((Foo.new("foo") * 5).class)
p Foo.new("foo").gsub(/foo/, "bar").class
p Foo.......まり、名前解
決中に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... -
Range
. new(first , last , exclude _ end = false) -> Range (18.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...t[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
#... -
Symbol
# next -> Symbol (13.0) -
シンボルに対応する文字列の「次の」文字列に対応するシンボルを返します。
...シンボルに対応する文字列の「次の」文字列に対応するシンボルを返します。
(self.to_s.next.intern と同じです。)
:a.next # => :b
:foo.next # => :fop
@see String#succ... -
NEWS for Ruby 3
. 0 . 0 (12.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...* String#slice!
* String#slice / String#[]
* String#split
* String#squeeze
* String#strip
* String#sub
* String#succ / String#next
* String#swapcase
* String#tr
* String#tr_s
* String#upcase
* Symbol
* Symbol#to_proc now returns a lam......tinuously improve the coverage of language features, analysis performance, and usability.
//emlist[][ruby]{
# test.rb
def foo(x)
if x > 10
x.to_s
else
nil
end
end
foo(42)
//}
//emlist{
$ typeprof test.rb
# Classes
class Object
def foo : (Integer) -> String?
end
//}
== Miscellaneo... -
Numeric (12.0)
-
数値を表す抽象クラスです。Integer や Float などの数値クラス は Numeric のサブクラスとして実装されています。
...----------------------------------------
step | o - - - - - -
succ | - o o - - - -
times | - o -......- o - -
to_r | - o - - o o o
to_s | - - o o o o o
truncate | o o -......size | - o - - -
step | o - - - -
succ | - o - - -
times | - o - - -......to_int | o o o - -
to_r | - o o o o
to_s | - o o o o
truncate | o o o o -...