るりまサーチ

最速Rubyリファレンスマニュアル検索!
1696件ヒット [201-300件を表示] (0.032秒)
トップページ > クエリ:end[x] > クエリ:test[x]

別のキーワード

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

ライブラリ

モジュール

キーワード

検索結果

<< < 1 2 3 4 5 ... > >>

ruby 1.8.3 feature (96.0)

ruby 1.8.3 feature *((<ruby 1.8 feature>)) *((<ruby 1.8.2 feature>))

...た。

$ cat mthd_taint.rb
th = Thread.new{
$SAFE = 3
class Hoge
def foo
puts "safe level: #{$SAFE}"
end

end

}
th.join
p $SAFE
Hoge.new.foo

$ ruby-1.8.2 mthd_taint.rb
0
"safe level: 0"

$ ruby-1.8.3 mthd_ta...
...るバグを修正しました。

$ cat r.rb
p /[\c\\]/ =~ "\c\\"
p /\c\\/ =~ "\c\\"

$ ruby-1.8.2 r.rb
r.rb:1: premature end of regular expression: /[\c\\]/
r.rb:2: invalid regular expression; '\' can't be last character: /\c\\/

$ ruby-1.8.3 r.rb
0
0

=...
...cat test_dlg.rb
foo = Object.new
foo2 = SimpleDelegator.new(foo)
def foo.bar
puts "bar"
end

foo2.bar

$ ruby-1.8.2 -r delegate test_dlg.rb
test
_dlg.rb:6: undefined method `bar' for #<Object:0x4021b0a0> (NoMethodError)

$ ruby-1.8.3 -r delegate test_dl...

shell (90.0)

Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。

..."shell-test-1" unless sh.exists?("shell-test-1")
sh.cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
unless sh.exists?(dir)
sh.mkdir dir
sh.cd(dir) do
f = sh.open("tmpFile", "w")
f.puts "TEST"
f.close
end

print sh.pwd
end

end


====...
...ll-test-1" unless exists?("shell-test-1")
cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
if !exists?(dir)
mkdir dir
cd(dir) do
f = open("tmpFile", "w")
f.print "TEST\n"
f.close
end

print pwd
end

end

end
...

Method#inspect -> String (84.0)

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

...//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 Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}

klass1 と klass2 が同じ場合は以...
...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...

Method#to_s -> String (84.0)

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

...//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 Bar.new.method(:bar) # => #<Method: Bar#bar(a, b) test.rb:8>
//}

klass1 と klass2 が同じ場合は以...
...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#const_source_location(name, inherited = true) -> [String, Integer] (84.0)

name で指定した定数の定義を含むソースコードのファイル名と行番号を配列で返します。

...ruby]{
# test.rb:
class A # line 1
C1 = 1
C2 = 2
end


module M # line 6
C3 = 3
end


class B < A # line 10
include M
C4 = 4
end


class A # 継続して A を定義する
C2 = 8 # 定数を再定義する
end


p B.const_source_location('C4') # => ["test.rb", 12...
...e_location('C3') # => ["test.rb", 7]
p B.const_source_location('C1') # => ["test.rb", 2]

p B.const_source_location('C3', false) # => nil -- include したモジュールは検索しない

p A.const_source_location('C2') # => ["test.rb", 16] -- 最後に定義さ...
...on('B') # => ["test.rb", 10] -- Object はトップレベルの定数を検索する
p Object.const_source_location('A') # => ["test.rb", 1] -- クラスが再定義された場合は最初の定義位置を返す

p B.const_source_location('A') # => ["test.rb", 1] -- Object...

絞り込み条件を変える

Rake::FileList#existing! -> self (84.0)

自身に含まれるファイルのうちファイルシステムに存在するファイルのみを 含むように自身を変更して返します。

...とする

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.existing! # => ["test1.rb", "test2.rb"]
file_list # => ["test1.rb", "test2.rb"]
end

//}...

Rake::FileList#ext(newext = &#39;&#39;) -> Rake::FileList (78.0)

各要素に String#ext を適用した新しい Rake::FileList を返します。

...file での記載例とする

IO.write("test1.rb", "test")
IO.write("test2.rb", "test")

task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.ext(".erb") # => ["test1.erb", "test2.erb", "test3.erb"]
end

//}

@see String#ext...

Kernel.#lambda -> Proc (72.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...がないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ではありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end


p foo().call #=> 1
//}

===[a:block] Proc オブジェクトをブロック付きメソッド呼び出しに使う

ブロック付きメソ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end


def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end


def test_block
tap { return :from_block }
return :from_method
end


p test_proc() #=> :from_proc
p test_lambda()...

Kernel.#lambda { ... } -> Proc (72.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...がないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ではありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end


p foo().call #=> 1
//}

===[a:block] Proc オブジェクトをブロック付きメソッド呼び出しに使う

ブロック付きメソ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end


def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end


def test_block
tap { return :from_block }
return :from_method
end


p test_proc() #=> :from_proc
p test_lambda()...
...e ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
proc(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...

Kernel.#proc -> Proc (72.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...がないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ではありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end


p foo().call #=> 1
//}

===[a:block] Proc オブジェクトをブロック付きメソッド呼び出しに使う

ブロック付きメソ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end


def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end


def test_block
tap { return :from_block }
return :from_method
end


p test_proc() #=> :from_proc
p test_lambda()...

絞り込み条件を変える

Kernel.#proc { ... } -> Proc (72.0)

与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。

...がないのにブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ではありません。


//emlist[例][ruby]{
def foo
f = Proc.new{
next 1
2 # この行に到達することはない
}
end


p foo().call #=> 1
//}

===[a:block] Proc オブジェクトをブロック付きメソッド呼び出しに使う

ブロック付きメソ...
...ruby]{
def test_proc
f = Proc.new { return :from_proc }
f.call
return :from_method
end


def test_lambda
f = lambda { return :from_lambda }
f.call
return :from_method
end


def test_block
tap { return :from_block }
return :from_method
end


p test_proc() #=> :from_proc
p test_lambda()...
...e ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
lambda(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...
...ise ArgumentError ブロックを省略した呼び出しを行ったときに発生します。

//emlist[例][ruby]{
def foo &block
proc(&block)
end


it = foo{p 12}
it.call #=> 12
//}

@see Proc,Proc.new

===[a:should_use_next] 手続きを中断して値を返す

手続きオブジェクトを...

NEWS for Ruby 3.1.0 (72.0)

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

...ッドに渡されるだけの場合は、ブロックの引数を無名にできるようになりました。 11256

//emlist{
def foo(&)
bar(&)
end

//}

* ピン演算子に式を書けるようになりました。 17411

//emlist{
Prime.each_cons(2).lazy.find_all{_1 in [n, ^(n + 2)]}.take(3...
...に持つ配列(シングルトンクラスを含まない)を返します。

//emlist[Class#subclasses][ruby]{
class A; end
class B < A; end
class C < B; end
class D < A; end
A.subclasses #=> [D, B]
B.subclasses #=> [C]
C.subclasses #=> []
//}

* Enumerable
* 新規メソッド...
...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に変更...
<< < 1 2 3 4 5 ... > >>