309件ヒット
[1-100件を表示]
(0.130秒)
別のキーワード
クラス
- Array (33)
- CSV (12)
-
Encoding
:: Converter (24) - File (24)
- Method (12)
-
Net
:: HTTPGenericRequest (24) - Object (48)
-
Rake
:: Application (12) - String (12)
- StringScanner (36)
-
Thread
:: SizedQueue (36) - UnboundMethod (12)
モジュール
-
Fiddle
:: Importer (12) -
Rake
:: TaskManager (12)
キーワード
- arity (24)
- bind (12)
-
body
_ stream (12) -
body
_ stream= (12) - deq (12)
-
each
_ index (12) -
enum
_ for (24) -
field
_ size _ limit (12) -
matched
_ size (12) - pack (21)
- peek (12)
- peep (12)
- pop (12)
-
primitive
_ convert (24) - shift (12)
-
synthesize
_ file _ task (12) -
to
_ enum (24) - truncate (12)
- unpack (12)
検索結果
先頭5件
-
File
# size -> Integer (18220.0) -
ファイルのサイズを返します。
...ファイルのサイズを返します。
//emlist[例][ruby]{
File.open("/dev/null") do |f|
f.size #=> 0
end
//}
@raise IOError 自身が close されている場合に発生します。
@raise Errno::EXXX 失敗した場合に発生します。
@see File#lstat... -
Rake
:: TaskManager # synthesize _ file _ task(task _ name) -> Rake :: FileTask | nil (15213.0) -
与えられたタスク名をもとにファイルタスクを合成します。
...成します。
@param task_name タスク名を指定します。
@return 与えられたタスク名と同名のファイルが存在する場合は、ファイルタスクを作成して返します。
そうでない場合は nil を返します。
@raise RuntimeError タスクを合......t[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do |task|
task.application.synthesize_file_task("sample_file") # => nil
IO.write("sample_file", "")
task.application.synthesize_file_task("sample_file") # => <Rake::FileTask sample_file => []>
end... -
StringScanner
# matched _ size -> Integer | nil (12244.0) -
前回マッチした部分文字列の長さを返します。 前回マッチに失敗していたら nil を返します。
...list[][ruby]{
require 'strscan'
def run(encode)
utf8 = "\u{308B 3073 3044}" # るびい
s = StringScanner.new(utf8.encode(encode))
s.scan(/#{"\u{308B}".encode(encode)}/)
s.matched_size
end
p run("UTF-8") #=> 3
p run("EUC-JP") #=> 2
p run("Shift_Jis") #=> 2
//}
//emlist[例][ruby]{......require 'strscan'
s = StringScanner.new('test string')
s.matched_size # => nil
s.scan(/\w+/) # => "test"
s.matched_size # => 4
s.scan(/\w+/) # => nil
s.matched_size # => nil
//}... -
CSV
# field _ size _ limit -> Integer (12238.0) -
フィールドサイズの最大値を返します。
.../emlist[例][ruby]{
require "csv"
csv = CSV.new(DATA)
csv.field_size_limit # => nil
p csv.read # => [["a", "b"], ["\n2\n2\n", ""]]
DATA.rewind
csv = CSV.new(DATA, field_size_limit: 4)
p csv.field_size_limit # => 4
csv.read # => #<CSV::MalformedCSVError: Field size exceeded on line 2.>
__END__
"a"... -
Thread
:: SizedQueue # shift(non _ block = false) -> object (9143.0) -
キューからひとつ値を取り出します。 キューに push しようと待っているスレッドがあれば、実行を再開させます。
...ock true を与えると、キューが空の時に例外 ThreadError が発生します。
//emlist[例][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start do
while resource = q.pop
puts resource
end
end
[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}
th1......}
//emlist[例: nonblock = true][ruby]{
require 'thread'
q = SizedQueue.new(4)
th1 = Thread.start do
while resource = q.pop
puts resource
end
end
[:resource1, :resource2, :resource3, nil].each{|r|
q.push(r)
}
begin
th1.join
q.pop(true)
rescue => e
p e
p e.message
end
# => res......ource1
# resource2
# resource3
# => #<ThreadError: queue empty>
# => "queue empty"
//}
@see Thread::Queue#pop... -
Rake
:: Application # options -> OpenStruct (9119.0) -
コマンドラインで与えられたアプリケーションのオプションを返します。
.../emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
Rake.application.options # => #<OpenStruct always_multitask=false, backtrace=false, build_all=false, dryrun=false, ignore_deprecate=false, ignore_system=false, job_stats=false, load_system=fa......lse, nosearch=false, rakelib=["rakelib"], show_all_tasks=false, show_prereqs=false, show_task_pattern=nil, show_tasks=nil, silent=false, suppress_backtrace_pattern=nil, thread_pool_size=8, trace=false, trace_output=#<IO:<STDERR>>, trace_rules=false>
end
//}... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (6919.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...:Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変......ptions 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output......re input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (6819.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...:Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変......ptions 変換の詳細を指定する定数やハッシュ
@return 変換結果を表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output......re input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Converter::AFTER_OUTPUT
戻り値は以下のうちのどれかです。
* :invalid_byte_sequence
* :incomplete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :... -
Object
# to _ enum(method = :each , *args) -> Enumerator (6279.0) -
Enumerator.new(self, method, *args) を返します。
...Enumerator.new(self, method, *args) を返します。
ブロックを指定した場合は Enumerator#size がブロックの評価結果を返
します。ブロックパラメータは引数 args です。
@param method メソッド名の文字列かシンボルです。
@param args 呼び出......。
//emlist[][ruby]{
str = "xyz"
enum = str.enum_for(:each_byte)
p(a = enum.map{|b| '%02x' % b }) #=> ["78", "79", "7a"]
# protects an array from being modified
a = [1, 2, 3]
p(a.to_enum) #=> #<Enumerator: [1, 2, 3]:each>
//}
//emlist[例(ブロックを指定する場合)][ruby]{
module Enumer......peat(n)
raise ArgumentError, "#{n} is negative!" if n < 0
unless block_given?
# __method__ はここでは :repeat
return to_enum(__method__, n) do
# size メソッドが nil でなければ size * n を返す。
sz = size
sz * n if sz
end
end...