種類
- 特異メソッド (48)
- モジュール関数 (24)
- 文書 (19)
- インスタンスメソッド (12)
クラス
- ERB (12)
オブジェクト
- ENV (24)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (5) -
NEWS for Ruby 3
. 1 . 0 (4) -
latest
_ gc _ info (24) - reject (24)
- リテラル (10)
検索結果
先頭5件
-
ERB
# result(b=TOPLEVEL _ BINDING) -> String (18155.0) -
ERB を b の binding で実行し、結果の文字列を返します。
...を b の binding で実行し、結果の文字列を返します。
@param b eRubyスクリプトが実行されるときのbinding
//emlist[例][ruby]{
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
puts erb.result
# test foo
# test bar
//}......し、結果の文字列を返します。
@param b eRubyスクリプトが実行されるときのbinding
//emlist[例][ruby]{
require 'erb'
erb = ERB.new("test <%= test1 %>\ntest <%= test2 %>\n")
test1 = "foo"
test2 = "bar"
puts erb.result
# test foo
# test bar
//}
@see ERB#result_with_hash... -
Kernel
. # test(cmd , file1 , file2) -> bool (18136.0) -
2ファイル間のファイルテストを行います。
...イル1とファイル2が同一のファイルである
//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}
# => =: true
# => <: false
# => >: false
# => -: false... -
Kernel
. # test(cmd , file) -> bool | Time | Integer | nil (18131.0) -
単体のファイルでファイルテストを行います。
...me
: ?A
ファイルの最終アクセス時刻を返す -> Time
: ?C
ファイルの inode 変更時刻を返す -> Time
//emlist[例][ruby]{
IO.write("testfile", "test")
test("r", "testfile") # => true
test("s", "testfile") # => 4
test("M", "testfile") # => 2018-03-31 07:38:40 +0900
//}... -
GC
. latest _ gc _ info(result _ hash = {}) -> Hash (6213.0) -
最新のGCの情報を返します。
...最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報か......す。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # => :newobj... -
GC
. latest _ gc _ info(key) -> object (6113.0) -
最新のGCの情報を返します。
...最新のGCの情報を返します。
@param result_hash 戻り値のためのハッシュを指定します。省略した場合は新
しくハッシュを作成します。result_hash の内容は上書き
されます。
@param key 得られる情報か......す。
//emlist[例][ruby]{
latest = GC.latest_gc_info
latest # => {:major_by=>nil, :gc_by=>:newobj, :have_finalizer=>false, :immediate_sweep=>false, :state=>:sweeping}
stat = GC.stat
merged = GC.latest_gc_info(stat)
merged == latest.merge(stat) # => true
GC.latest_gc_info(:gc_by) # => :newobj... -
NEWS for Ruby 3
. 1 . 0 (60.0) -
NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...では、
//emlist[][ruby]{
foo[0] = bar
//}
* 次の評価順序になります。
//emlist{
1. `foo`
2. `bar`
3. `[]=` called on the result of `foo`
//}
* Ruby 3.1.0より前は、多重代入の評価順序が上記のようではありませんでした。このコードでは、......led on the result of `foo`
5. `bar`
6. `baz=` called on the result of `bar`
//}
* Ruby 3.1.0から単一代入と評価順序が一致するようになり、左が右より先に評価されます。
//emlist{
1. `foo`
2. `bar`
3. `a`
4. `b`
5. `[]=` called on the result of `foo`......2.0
* uri 0.11.0
* yaml 0.2.0
* zlib 2.1.1
* 以下のbundled gemsが更新されました。
* minitest 5.15.0
* power_assert 2.0.1
* rake 13.0.6
* test-unit 3.5.3
* rexml 3.2.5
* rbs 2.0.0
* typeprof 0.21.1
* 以下のdefault gemsがbundled gemsに変更... -
ENV
. reject -> Enumerator (36.0) -
環境変数のうち、ブロックを評価した値が真であるものをとり除きます。 Enumerable#reject と異なり Hash を返します。また、とり除いた結果 は実際の環境変数に影響を与えません。
...除きます。
Enumerable#reject と異なり Hash を返します。また、とり除いた結果
は実際の環境変数に影響を与えません。
//emlist[][ruby]{
ENV['TEST'] = 'foo'
result = ENV.reject { |key, value| key == 'TEST' }
result['TEST'] # => nil
ENV['TEST'] # => "foo"
//}... -
ENV
. reject {|key , value| . . . } -> Hash (36.0) -
環境変数のうち、ブロックを評価した値が真であるものをとり除きます。 Enumerable#reject と異なり Hash を返します。また、とり除いた結果 は実際の環境変数に影響を与えません。
...除きます。
Enumerable#reject と異なり Hash を返します。また、とり除いた結果
は実際の環境変数に影響を与えません。
//emlist[][ruby]{
ENV['TEST'] = 'foo'
result = ENV.reject { |key, value| key == 'TEST' }
result['TEST'] # => nil
ENV['TEST'] # => "foo"
//}... -
NEWS for Ruby 3
. 0 . 0 (30.0) -
NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...さい。
== 言語仕様の変更
* Keyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer......nVariable#wait may now invoke the `block`/`unblock` scheduler hooks in a non-blocking context. 16786
* Dir
* Dir.glob and Dir.[] now sort the results by default, and accept the `sort:` keyword option. 8709
* ENV
* ENV.except has been added, which returns a hash excluding the given keys......`true` will cause compaction to occur during major collections. At the moment, compaction adds significant overhead to major collections, so please test first! 17176
* Hash
* Hash#transform_keys and Hash#transform_keys! now accept a hash that maps keys to new keys. 16274
* Hash#except h... -
リテラル (18.0)
-
リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent
...うに `~` を付けて書くことで、以下のような
ヒアドキュメントを書くことができます。
//emlist[][ruby]{
expected_result = <<~SQUIGGLY_HEREDOC
This would contain specially formatted text.
That might span many lines
SQUIGGLY_HEREDOC
# => "This would contain specia......price is #{$price}.
EOS
# 式展開はできない
print <<'EOS'
The price is #{$price}.
EOS
# コマンドを実行
print <<`EOC`
date
diff test.c.org test.c
EOC
//}
文字列リテラルのそれぞれの性質に関しては
string、
exp、
backslash、
command
を参照してください。...