別のキーワード
キーワード
-
allocation
_ sourcefile (12) - blockdev? (12)
-
caller
_ locations (24) - chardev? (12)
- chomp (12)
- chop (12)
- directory? (12)
- dump (12)
- empty? (9)
- executable? (12)
-
executable
_ real? (12) - exist? (12)
- exists? (9)
- file? (12)
- grpowned? (12)
- gsub (36)
- identical? (12)
- lambda (18)
- mask (12)
- mask= (12)
- mkdir (12)
- move (12)
- mv (12)
- owned? (12)
- pipe? (12)
- proc (19)
- readable? (12)
-
readable
_ real? (12) - setgid? (12)
- setuid? (12)
- size (12)
- size? (12)
- socket? (12)
- sticky? (12)
- symlink? (12)
- warn (8)
-
world
_ readable? (12) -
world
_ writable? (12) - writable? (12)
-
writable
_ real? (12) - zero? (12)
検索結果
先頭5件
-
Kernel
. # lambda -> Proc (37.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...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()......#=> :from_method
p test_block() #=> :from_block
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェクトが定義されたのと
同じメソッド内で行った場合の結果です。
return... -
Kernel
. # lambda { . . . } -> Proc (37.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...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()......#=> :from_method
p test_block() #=> :from_block
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェクトが定義されたのと
同じメソッド内で行った場合の結果です。
return... -
Kernel
. # proc -> Proc (37.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...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()......#=> :from_method
p test_block() #=> :from_block
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェクトが定義されたのと
同じメソッド内で行った場合の結果です。
return... -
Kernel
. # proc { . . . } -> Proc (37.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...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()......#=> :from_method
p test_block() #=> :from_block
//}
以下の表は、手続きオブジェクトの実行を上の例と同じように、手続きオブジェクトが定義されたのと
同じメソッド内で行った場合の結果です。
return... -
FileUtils
. # move(src , dest , options = {}) -> () (13.0) -
ファイル src を dest に移動します。
...c:FileUtils#options
//emlist[][ruby]{
require 'fileutils'
FileUtils.mv('badname.rb', 'goodname.rb')
FileUtils.mv('stuff.rb', 'lib/ruby', force: true)
FileUtils.mv(['junk.txt', 'dust.txt'], "#{ENV['HOME']}/.trash")
FileUtils.mv(Dir.glob('test*.rb'), 'test', noop: true, verbose: true)
//}... -
FileUtils
. # mv(src , dest , options = {}) -> () (13.0) -
ファイル src を dest に移動します。
...c:FileUtils#options
//emlist[][ruby]{
require 'fileutils'
FileUtils.mv('badname.rb', 'goodname.rb')
FileUtils.mv('stuff.rb', 'lib/ruby', force: true)
FileUtils.mv(['junk.txt', 'dust.txt'], "#{ENV['HOME']}/.trash")
FileUtils.mv(Dir.glob('test*.rb'), 'test', noop: true, verbose: true)
//}... -
JSON
. # dump(object , io = nil , limit = nil) -> String | IO (13.0) -
与えられたオブジェクトを JSON 形式の文字列に変換してダンプします。
...ka", age: 19 }) # => "{\"name\":\"tanaka\",\"age\":19}"
//}
//emlist[例][ruby]{
require "json"
File.open("test.txt", "w") do |f|
JSON.dump([[[[[[[[[[]]]]]]]]]], f, 10) # => #<File:test.txt>
JSON.dump([[[[[[[[[[[]]]]]]]]]]], f, 10) # => exceed depth limit (ArgumentError)
end
//}
@see Marsha... -
ObjectSpace
. # allocation _ sourcefile(object) -> String (13.0) -
objectの元となったソースファイル名を返します。
...返します。
//emlist[例:test.rbというファイルで下記のスクリプトを実行した場合][ruby]{
require 'objspace'
ObjectSpace::trace_object_allocations_start
obj = Object.new
puts "file:#{ObjectSpace::allocation_sourcefile(obj)}" # => file:test.rb
ObjectSpace::trace_object_all... -
FileUtils
. # mkdir(dir , options = {}) -> () (7.0) -
ディレクトリ dir を作成します。
...作成するディレクトリ。
@param options :mode, :noop, :verbose が指定できます。
c:FileUtils#options
//emlist[][ruby]{
require 'fileutils'
FileUtils.mkdir('test')
FileUtils.mkdir(%w( tmp data ))
FileUtils.mkdir('notexist', noop: true) # does not create really
//}... -
Kernel
. # gsub(pattern) -> Enumerator (7.0) -
$_.gsub とほぼ同じですが、置換が発生したときは、$_の内容を置き換える点が異なります。 コマンドラインオプションで -p または -n を指定した時のみ定義されます。
...規表現。
文字列を指定した場合は全く同じ文字列にだけマッチする
@param replace pattern で指定した文字列と置き換える文字列
//emlist[例][ruby]{
$_ # => "test\n"
gsub(/es/, '!!') # => "t!!t\n"
//}
@see String#gsub,$_...