ライブラリ
- ビルトイン (242)
-
cgi
/ core (1) - csv (1)
- date (6)
- dbm (1)
- etc (1)
- expect (2)
-
fiddle
/ import (1) - getoptlong (1)
- ipaddr (1)
- logger (3)
- matrix (29)
- mkmf (5)
-
net
/ ftp (9) -
net
/ http (28) -
net
/ imap (5) - openssl (15)
- optparse (4)
- pathname (16)
- prime (6)
- rake (8)
-
rdoc
/ context (2) -
rdoc
/ top _ level (1) -
rexml
/ document (27) -
rinda
/ tuplespace (1) -
rubygems
/ commands / unpack _ command (1) -
rubygems
/ dependency _ list (1) -
rubygems
/ gem _ path _ searcher (1) -
rubygems
/ package / tar _ input (1) -
rubygems
/ package / tar _ output (1) -
rubygems
/ remote _ fetcher (2) -
rubygems
/ source _ index (1) -
rubygems
/ source _ info _ cache (1) -
rubygems
/ specification (2) -
rubygems
/ user _ interaction (3) - scanf (2)
- set (2)
- shell (4)
-
shell
/ builtin-command (2) -
shell
/ command-processor (4) -
shell
/ filter (4) - socket (3)
- stringio (3)
- strscan (6)
-
syslog
/ logger (1) - tempfile (1)
- tsort (2)
- uri (1)
-
webrick
/ httputils (6) - zlib (6)
クラス
-
ARGF
. class (13) - Array (24)
- BasicSocket (1)
- Bignum (10)
- CSV (1)
- DBM (1)
- Date (6)
- Enumerator (2)
-
Enumerator
:: Lazy (25) -
Enumerator
:: Yielder (2) - File (6)
-
File
:: Stat (10) - Fixnum (9)
- Float (6)
-
Gem
:: Commands :: UnpackCommand (1) -
Gem
:: DependencyList (1) -
Gem
:: GemPathSearcher (1) -
Gem
:: Package :: TarInput (1) -
Gem
:: Package :: TarOutput (1) -
Gem
:: RemoteFetcher (2) -
Gem
:: SourceIndex (1) -
Gem
:: SourceInfoCache (1) -
Gem
:: Specification (2) -
Gem
:: StreamUI (3) - GetoptLong (1)
- Hash (10)
- IO (12)
- IPAddr (1)
- Integer (4)
- LoadError (1)
- Logger (3)
- MatchData (7)
- Matrix (25)
-
Matrix
:: LUPDecomposition (1) - Method (1)
- Module (1)
-
Net
:: FTP (8) -
Net
:: FTP :: MLSxEntry (1) -
Net
:: HTTP (28) -
Net
:: IMAP (2) -
Net
:: IMAP :: Address (1) -
Net
:: IMAP :: Envelope (1) -
Net
:: IMAP :: ResponseCode (1) - Numeric (10)
-
OpenSSL
:: OCSP :: BasicResponse (1) -
OpenSSL
:: PKCS7 (1) -
OpenSSL
:: PKey :: EC (1) -
OpenSSL
:: SSL :: SSLContext (5) -
OpenSSL
:: SSL :: SSLSocket (3) -
OpenSSL
:: X509 :: ExtensionFactory (2) -
OpenSSL
:: X509 :: Store (1) -
OpenSSL
:: X509 :: StoreContext (1) - OptionParser (4)
- Pathname (16)
- Prime (2)
-
Prime
:: PseudoPrimeGenerator (4) - Proc (1)
-
Process
:: Status (3) -
RDoc
:: Context (2) -
RDoc
:: Options (3) -
RDoc
:: TopLevel (1) -
REXML
:: AttlistDecl (2) -
REXML
:: Attribute (1) -
REXML
:: Attributes (5) -
REXML
:: DocType (2) -
REXML
:: Element (6) -
REXML
:: Elements (3) -
REXML
:: Entity (1) -
REXML
:: NotationDecl (2) -
REXML
:: Parent (5) -
Rake
:: FileList (2) -
Rake
:: FileTask (1) - Random (3)
- Range (1)
- Rational (12)
- Regexp (2)
-
Rinda
:: TupleSpace (1) -
RubyVM
:: InstructionSequence (1) - Set (2)
- Shell (4)
-
Shell
:: Cat (1) -
Shell
:: CommandProcessor (4) -
Shell
:: Concat (1) -
Shell
:: Filter (4) -
Socket
:: AncillaryData (2) - String (18)
- StringIO (3)
- StringScanner (6)
- Struct (1)
- Symbol (1)
-
Syslog
:: Logger (1) - Tempfile (1)
- Thread (3)
-
Thread
:: Backtrace :: Location (4) - Time (1)
-
URI
:: Generic (1) - UnboundMethod (1)
- Vector (3)
-
WEBrick
:: HTTPUtils :: FormData (6) -
Zlib
:: Deflate (1) -
Zlib
:: GzipReader (3) -
Zlib
:: GzipWriter (1) -
Zlib
:: Inflate (1)
モジュール
-
CGI
:: QueryExtension (1) - Enumerable (41)
-
Fiddle
:: Importer (1) - FileUtils (2)
- Kernel (7)
-
Rake
:: TaskManager (2) - TSort (2)
キーワード
- % (2)
- * (3)
- ** (3)
- + (3)
- - (4)
-
/ (3) - << (1)
- <=> (5)
- [] (10)
-
absolute
_ path (2) - accept (1)
-
add
_ bindir (1) -
add
_ gem _ contents (1) - alert (1)
-
alert
_ error (1) -
alert
_ warning (1) - angle (2)
-
append
_ features (1) - arg (2)
- ascend (1)
- atime (1)
- attribute (1)
-
attribute
_ of (1) -
backtrace
_ locations (2) -
base
_ label (1) - begin (1)
- bind (1)
- binread (1)
- blockdev? (1)
- bytes (1)
-
ca
_ path (2) - cat (3)
- ceil (2)
- cert (2)
- certificates (1)
- chain (2)
- chardev? (1)
- chars (1)
- chunk (3)
-
chunk
_ while (1) -
client
_ ca (1) - codepoints (1)
- cofactor (1)
-
cofactor
_ expansion (1) - collect (7)
- collect! (1)
- collect2 (1)
-
collect
_ concat (3) - column (2)
- combination (1)
- create (1)
-
create
_ body (1) -
create
_ rule (1) - cycle (2)
- data (1)
- date (1)
-
datetime
_ format (1) -
default
_ executable (1) -
delete
_ at (2) -
delete
_ attribute (1) -
delete
_ if (3) - descend (1)
-
det
_ e (1) - detect (1)
-
determinant
_ e (1) - div (2)
- downto (1)
-
drop
_ while (3) - each (18)
-
each
_ attribute (1) -
each
_ byte (2) -
each
_ char (2) -
each
_ child (3) -
each
_ codepoint (1) -
each
_ cons (1) -
each
_ data (1) -
each
_ element (1) -
each
_ element _ with _ attribute (1) -
each
_ entry (2) -
each
_ filename (1) -
each
_ index (1) -
each
_ line (10) -
each
_ slice (1) -
each
_ strongly _ connected _ component (1) -
each
_ strongly _ connected _ component _ from (1) -
each
_ value (1) -
each
_ with _ index (4) -
each
_ with _ object (1) - egrep (1)
-
egrep
_ cpp (2) - end (1)
-
enhance
_ with _ matching _ rule (1) -
enum
_ for (2) - exclude (1)
- exitstatus (1)
- expect (2)
-
extra
_ chain _ cert (1) - fdiv (3)
-
fetch
_ path (1) -
fetch
_ values (2) - filename (1)
- filename= (1)
- find (3)
-
find
_ all (2) -
find
_ enclosing _ module _ named (1) -
find
_ executable (1) -
find
_ index (4) -
find
_ local _ symbol (1) -
find
_ name (1) -
flat
_ map (3) - flatten (2)
- flatten! (2)
- flock (2)
- floor (2)
- foreach (3)
- formatter (2)
- formatter= (1)
- get (3)
- get2 (2)
-
get
_ attribute (1) -
get
_ attribute _ ns (1) -
get
_ path (1) -
get
_ text (1) - getbinaryfile (1)
- glob (3)
- grep (3)
-
grep
_ v (3) -
group
_ by (1) - gsub (1)
- gsub! (3)
- head (1)
- head2 (2)
- index (4)
- infinite? (1)
- inject (1)
- inspect (1)
-
issuer
_ certificate (1) -
laplace
_ expansion (1) - lazy (1)
- libpathflag (1)
- lines (7)
-
link
_ command (1) -
load
_ gemspec (1) - lstat (1)
- map (6)
- map! (1)
- match (5)
- match? (1)
- matched (1)
-
matched
_ size (1) - matchedsize (1)
-
max
_ by (2) -
min
_ by (2) -
minmax
_ by (1) - mlsd (2)
- modulo (2)
- name (1)
- name= (1)
- namespace (1)
- native (1)
- ndata (1)
- notation (1)
- notify (1)
- offset (2)
- on (3)
- open (5)
-
open
_ uri _ or _ path (1) - opendir (1)
- pack (1)
-
page
_ dir (1) - partition (1)
- patch (2)
- path (4)
- pathconf (1)
- pathmap (1)
-
peer
_ cert (2) -
peer
_ cert _ chain (1) - permutation (2)
- phase (2)
- post (2)
- post2 (2)
-
post
_ match (1) -
pre
_ match (1) - printf (1)
-
private
_ key (1) - public (1)
- put (1)
- put2 (2)
- putbinaryfile (1)
- quo (2)
- rand (3)
- read (1)
- recvmsg (1)
- reject (2)
- reject! (2)
- remainder (1)
-
renegotiation
_ cb (1) -
renegotiation
_ cb= (1) -
repeated
_ combination (1) -
repeated
_ permutation (1) - request (2)
-
request
_ get (2) -
request
_ head (2) -
request
_ post (2) -
request
_ put (2) - retrbinary (1)
-
reverse
_ each (1) - rindex (1)
- round (3)
- route (1)
- row (2)
- ruby (1)
- scan (1)
- scanf (2)
- select (5)
- select! (2)
-
set
_ dictionary (2) - setgid? (1)
- setuid? (1)
- sh (1)
- size (2)
- size? (1)
-
slice
_ after (4) -
slice
_ before (5) -
slice
_ when (2) - socket? (1)
- solve (1)
-
sort
_ by (1) -
source
_ location (3) - specification (1)
- stat (1)
- status (2)
- step (7)
- sticky? (1)
- stopsig (1)
- storbinary (1)
- store (1)
- sub (2)
- sub! (2)
-
subject
_ certificate (1) - subsec (1)
- system (1)
-
take
_ while (4) -
template
_ dir (1) - terminated? (1)
- termsig (1)
- text (1)
-
to
_ enum (2) -
to
_ i (1) -
to
_ path (1) -
to
_ s (1) - tr (1)
- tr! (1)
-
tr
_ s! (1) - trace (1)
- truncate (3)
-
try
_ file (1) -
uid
_ store (1) -
unix
_ rights (1) - unpack (1)
- update (3)
-
upper
_ bound (1) - upto (1)
- visibility (2)
-
with
_ index (1) -
world
_ readable? (1) -
world
_ writable? (1) - yield (1)
- zip (1)
検索結果
先頭5件
-
Enumerator
:: Lazy # flat _ map {|item| . . . } -> Enumerator :: Lazy (46546.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
Enumerable
# collect _ concat {| obj | block } -> Array (46246.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# flat _ map {| obj | block } -> Array (46246.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerator
:: Lazy # collect _ concat {|item| . . . } -> Enumerator :: Lazy (46246.0) -
ブロックの実行結果をひとつに繋げたものに対してイテレートするような Enumerator::Lazy のインスタンスを返します。
ブロックの実行結果をひとつに繋げたものに対してイテレートするような
Enumerator::Lazy のインスタンスを返します。
//emlist[][ruby]{
["foo", "bar"].lazy.flat_map {|i| i.each_char.lazy}.force
#=> ["f", "o", "o", "b", "a", "r"]
//}
ブロックの返した値 x は、以下の場合にのみ分解され、連結されます。
* x が配列であるか、to_ary メソッドを持つとき
* x が each および force メソッドを持つ (例:Enumerator::Lazy) ... -
Logger
# datetime _ format -> String | nil (46207.0) -
ログに記録する時の日付のフォーマットです。
ログに記録する時の日付のフォーマットです。
デフォルトでは nil ですが、この値が nil の場合は日付のフォーマットとして
"%Y-%m-%dT%H:%M:%S.%06d " を使用します。
なお、"%06d" には Time#strftime ではなく、単に Time#usec の
値を String#% でフォーマットしたものが入ります。
//emlist[例][ruby]{
require 'logger'
logger = Logger.new(STDOUT)
logger.datetime_format # => nil
logger.debug("test")
lo... -
Enumerable
# collect _ concat -> Enumerator (45946.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Enumerable
# flat _ map -> Enumerator (45946.0) -
各要素をブロックに渡し、その返り値を連結した配列を返します。
各要素をブロックに渡し、その返り値を連結した配列を返します。
ブロックの返り値は基本的に配列を返すべきです。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
[[1,2], [3,4]].flat_map{|i| i.map{|j| j*2}} # => [2,4,6,8]
//} -
Array
# at(nth) -> object | nil (45919.0) -
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。
@param nth インデックスを整数で指定します。
先頭の要素が 0 番目になります。nth の値が負の時には末尾から
のインデックスと見倣します。末尾の要素が -1 番目になります。
整数以外のオブジェクトを指定した場合は to_int メソッドによる
暗黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定... -
Thread
:: Backtrace :: Location # absolute _ path -> String (45640.0) -
self が表すフレームの絶対パスを返します。
self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see... -
Kernel
# libpathflag(libpath = $ DEFLIBPATH| $ LIBPATH) -> String (38752.0) -
与えられた libpath を -L 付きの文字列に変換して返します。
与えられた libpath を -L 付きの文字列に変換して返します。
@param libpath LIBPATH に指定する値を指定します。 -
Thread
# backtrace _ locations(range) -> [Thread :: Backtrace :: Location] | nil (37510.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。
Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]... -
Thread
# backtrace _ locations(start = 0 , length = nil) -> [Thread :: Backtrace :: Location] | nil (37510.0) -
スレッドの現在のバックトレースを Thread::Backtrace::Location の配 列で返します。
スレッドの現在のバックトレースを Thread::Backtrace::Location の配
列で返します。
引数で指定した値が範囲外の場合、スレッドがすでに終了している場合は nil
を返します。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。
Kernel.#caller_locations と似ていますが、本メソッドは self に限定
した情報を返します。
//emlist[例][ruby]... -
REXML
:: Element # each _ element _ with _ attribute(key , value = nil , max = 0 , name = nil) {|element| . . . } -> () (37279.0) -
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
特定の属性を持つすべての子要素を引数としてブロックを呼び出します。
key で指定した属性名の属性を持つ要素のみを対象とします。
value を指定すると、keyで指定した属性名を持つ属性の値がvalueである
もののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対象となります。
name を指定すると、それは xpath 文字列と見なされ、
それにマッチするもののみが対象となります。
max に 0 を指定すると、max の指定は無視されます(0個ではありません)。
@param key 属性名(文字列)
@param value 属性値(文字列)
... -
Array
# repeated _ combination(n) { |c| . . . } -> self (37228.0) -
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。
サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行
します。
得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返します。
@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emli... -
Array
# repeated _ permutation(n) { |p| . . . } -> self (37228.0) -
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。
得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。
@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][ruby... -
REXML
:: Attributes # get _ attribute(name) -> Attribute | nil (37207.0) -
name という名前の属性を取得します。
name という名前の属性を取得します。
name という名前を持つ属性がない場合は nil を返します。
@param name 属性名(文字列)
@see REXML::Attributes#[]
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<-EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='... -
REXML
:: Attributes # get _ attribute _ ns(namespace , name) -> REXML :: Attribute | nil (37207.0) -
namespace と name で特定される属性を返します。
namespace と name で特定される属性を返します。
namespace で名前空間を、 name で prefix を含まない属性名を
指定します。
指定された属性が存在しない場合は nil を返します。
XML プロセッサが prefix を置き換えてしまった場合でも、このメソッドを
使うことで属性を正しく指定することができます。
@param namespace 名前空間(URI, 文字列)
@param name 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.ne... -
REXML
:: Element # delete _ attribute(key) -> REXML :: Attribute | nil (37207.0) -
要素から key という属性名の属性を削除します。
要素から key という属性名の属性を削除します。
削除された属性を返します。
key という属性名の属性が存在しない場合は削除されずに、nil を返します。
@param key 削除する要素(文字列(属性名) or REXML::Attributeオブジェクト)
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("E")
e.add_attribute("x", "foo"); e # => <E x='foo'/>
e.add_attribute("y:x", "bar"); e # => <E x... -
Rake
:: TaskManager # enhance _ with _ matching _ rule(task _ name , level = 0) -> Rake :: Task | nil (37207.0) -
与えられたタスク名にマッチしたルールが存在する場合は、そのタスクに見つかったルールの 事前タスクとアクションを追加して返します。
与えられたタスク名にマッチしたルールが存在する場合は、そのタスクに見つかったルールの
事前タスクとアクションを追加して返します。
@param task_name タスクの名前を指定します。
@param level 現在のルール解決のネストの深さを指定します。
@raise RuntimeError ルールの解決時にオーバーフローした場合に発生します。 -
Syslog
:: Logger # formatter -> Logger :: Formatter | Proc (37207.0) -
ログを出力する際に使用するフォーマッターを取得します。
ログを出力する際に使用するフォーマッターを取得します。
デフォルトでは Logger::Formatter オブジェクトを返します。
@see Syslog::Logger#formatter= -
Array
# delete _ at(pos) -> object | nil (36946.0) -
指定された位置 pos にある要素を取り除きそれを返します。 pos が範囲外であったら nil を返します。
指定された位置 pos にある要素を取り除きそれを返します。
pos が範囲外であったら nil を返します。
Array#at と同様に負のインデックスで末尾から位置を指定するこ
とができます。
@param pos 削除したい要素のインデックスを整数で指定します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる
暗黙の型変換を試みます。
@raise TypeError 引数に整数以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。
//emlist[例][r... -
REXML
:: Attributes # each _ attribute {|attribute| . . . } -> () (36943.0) -
各属性に対しブロックを呼び出します。
各属性に対しブロックを呼び出します。
個々の属性は REXML::Attribute オブジェクトで渡されます。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root xmlns:foo="http://example.org/foo"
xmlns:bar="http://example.org/bar">
<a foo:att='1' bar:att='2' att='<'/>
</root>
EOS
a = doc.get_elements("/root... -
File
# lstat -> File :: Stat (36940.0) -
ファイルの状態を含む File::Stat オブジェクトを生成して返します。 シンボリックリンクに関してリンクそのものの情報を返します。 lstat(2) を実装していないシステムでは、IO#statと同じです。
ファイルの状態を含む File::Stat オブジェクトを生成して返します。
シンボリックリンクに関してリンクそのものの情報を返します。
lstat(2) を実装していないシステムでは、IO#statと同じです。
@raise Errno::EXXX 失敗した場合に発生します。
@raise IOError 自身が close されている場合に発生します。
//emlist[例][ruby]{
# testlink は testfile のシンボリックリンク
File.open("testlink") do |f|
p f.lstat == File.stat("testfil... -
REXML
:: Parent # delete _ at(index) -> REXML :: Child | nil (36910.0) -
子ノード列上の index で指定された場所の要素を取り除きます。
子ノード列上の index で指定された場所の要素を取り除きます。
取り除いだノードを返します。indexが範囲外である場合は何もせず
nil を返します。 -
Array
# flatten!(lv = nil) -> self | nil (36907.0) -
flatten は自身を再帰的に平坦化した配列を生成して返します。flatten! は 自身を再帰的かつ破壊的に平坦化し、平坦化が行われた場合は self をそうでない 場合は nil を返します。 lv が指定された場合、lv の深さまで再帰的に平坦化します。
flatten は自身を再帰的に平坦化した配列を生成して返します。flatten! は
自身を再帰的かつ破壊的に平坦化し、平坦化が行われた場合は self をそうでない
場合は nil を返します。
lv が指定された場合、lv の深さまで再帰的に平坦化します。
@param lv 平坦化の再帰の深さを整数で指定します。nil を指定した場合、再
帰の深さの制限無しに平坦化します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(... -
Method
# source _ location -> [String , Integer] | nil (36907.0) -
ソースコードのファイル名と行番号を配列で返します。
ソースコードのファイル名と行番号を配列で返します。
その手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
@see Proc#source_location
//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
def foo; end
end
# ----- end of /tmp/foo.rb ----
require '/tmp/foo'
m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m.source... -
OpenSSL
:: SSL :: SSLContext # ca _ path -> String | nil (36907.0) -
信頼している CA 証明書ファイルを含むディレクトリを返します。
信頼している CA 証明書ファイルを含むディレクトリを返します。
設定されていない場合は nil を返します。
@see OpenSSL::SSL::SSLContext#ca_path= -
OpenSSL
:: SSL :: SSLContext # renegotiation _ cb -> nil | Proc (36907.0) -
ハンドシェイク開始時に呼び出されるコールバックを得ます。
ハンドシェイク開始時に呼び出されるコールバックを得ます。
@see OpenSSL::SSL::SSLContext#renegotiation_cb= -
Proc
# source _ location -> [String , Integer] | nil (36907.0) -
ソースコードのファイル名と行番号を配列で返します。
ソースコードのファイル名と行番号を配列で返します。
その手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
# /path/to/target.rb を実行
proc {}.source_location # => ["/path/to/target.rb", 1]
proc {}.source_location # => ["/path/to/target.rb", 2]
(eval "proc {}").source_location # => ... -
RDoc
:: Options # template _ dir -> String | nil (36907.0) -
コマンドライン引数の --template オプションで指定したテンプレートに対応 するディレクトリを返します。
コマンドライン引数の --template オプションで指定したテンプレートに対応
するディレクトリを返します。
オプションの解析前は nil を返します。 -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (36907.0) -
self が表す命令シーケンスの絶対パスを返します。
self が表す命令シーケンスの絶対パスを返します。
self を文字列から作成していた場合は nil を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.... -
Set
# flatten! -> self | nil (36907.0) -
集合を再帰的に平坦化します。
集合を再帰的に平坦化します。
flatten は、平坦化した集合を新しく作成し、それを返します。
flatten! は、元の集合を破壊的に平坦化します。集合の要素に変更が
発生した場合には self を、そうでない場合には nil を返します。
@raise ArgumentError 集合の要素として self が再帰的に現れた場合に発生
します。
//emlist[][ruby]{
require 'set'
s = Set[Set[1,2], 3]
p s.flatten # => #<Set: {1, 2, 3}>
p s ... -
UnboundMethod
# source _ location -> [String , Integer] | nil (36907.0) -
ソースコードのファイル名と行番号を配列で返します。
ソースコードのファイル名と行番号を配列で返します。
その手続オブジェクトが ruby で定義されていない(つまりネイティブ
である)場合は nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
/... -
Rake
:: TaskManager # create _ rule(*args) { . . . } (36640.0) -
与えられたパラメータに従ってルールを作成します。
与えられたパラメータに従ってルールを作成します。
@param args ルールに与えるパラメータを指定します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
rule = Rake.application.create_rule '.txt' => '.md' do |t|
"#{t}"
end
p rule # => 0x0000558dd2e32d20 /path/to/Rakefile:5>
end
//} -
WEBrick
:: HTTPUtils :: FormData # each _ data {|s| . . . } (36625.0) -
自身が表す各フォームデータを引数として、与えられたブロックを実行します。
自身が表す各フォームデータを引数として、与えられたブロックを実行します。
例:
require "webrick/cgi"
class MyCGI < WEBrick::CGI
def do_GET(req, res)
req.query['q'].each_data{|s|
p s
}
#=> "val1"
"val2"
"val3"
end
end
MyCGI.new.start() -
Array
# flatten(lv = nil) -> Array (36607.0) -
flatten は自身を再帰的に平坦化した配列を生成して返します。flatten! は 自身を再帰的かつ破壊的に平坦化し、平坦化が行われた場合は self をそうでない 場合は nil を返します。 lv が指定された場合、lv の深さまで再帰的に平坦化します。
flatten は自身を再帰的に平坦化した配列を生成して返します。flatten! は
自身を再帰的かつ破壊的に平坦化し、平坦化が行われた場合は self をそうでない
場合は nil を返します。
lv が指定された場合、lv の深さまで再帰的に平坦化します。
@param lv 平坦化の再帰の深さを整数で指定します。nil を指定した場合、再
帰の深さの制限無しに平坦化します。
整数以外のオブジェクトを指定した場合は to_int メソッドによる暗
黙の型変換を試みます。
@raise TypeError 引数に整数以外の(... -
File
:: Stat # world _ readable? -> Integer | nil (36607.0) -
全てのユーザから読めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
全てのユーザから読めるならば、そのファイルのパーミッションを表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
//emlist[][ruby]{
m = File.stat("/etc/passwd").world_readable? # => 420
sprintf("%o", m) # => "644"
//} -
File
:: Stat # world _ writable? -> Integer | nil (36607.0) -
全てのユーザから書き込めるならば、そのファイルのパーミッションを表す 整数を返します。そうでない場合は nil を返します。
全てのユーザから書き込めるならば、そのファイルのパーミッションを表す
整数を返します。そうでない場合は nil を返します。
整数の意味はプラットフォームに依存します。
//emlist[][ruby]{
m = File.stat("/tmp").world_writable? # => 511
sprintf("%o", m) # => "777"
//} -
Set
# flatten -> Set (36607.0) -
集合を再帰的に平坦化します。
集合を再帰的に平坦化します。
flatten は、平坦化した集合を新しく作成し、それを返します。
flatten! は、元の集合を破壊的に平坦化します。集合の要素に変更が
発生した場合には self を、そうでない場合には nil を返します。
@raise ArgumentError 集合の要素として self が再帰的に現れた場合に発生
します。
//emlist[][ruby]{
require 'set'
s = Set[Set[1,2], 3]
p s.flatten # => #<Set: {1, 2, 3}>
p s ... -
Enumerator
:: Yielder # yield(*object) -> () (36376.0) -
Enumerator.new で使うメソッドです。
Enumerator.new で使うメソッドです。
生成された Enumerator オブジェクトの each メソッドを呼ぶと
Enumerator::Yielder オブジェクトが渡されたブロックが実行され、
ブロック内の yield メソッドが呼ばれるたびに each に渡された
ブロックが yield メソッドに渡された値とともに繰り返されます。
//emlist[例][ruby]{
enum = Enumerator.new do |y|
y.yield 1, 2, 3
end
enum.each do |x, y, z|
p [x, y, z]
end
# => [... -
OpenSSL
:: SSL :: SSLContext # renegotiation _ cb=(cb) (36340.0) -
@todo
@todo
ハンドシェイク開始時に呼び出されるコールバックを設定します。
コールバックには OpenSSL::SSL::SSLSocket オブジェクトが
渡されます。
このコールバック内で何らかの例外が生じた場合には
以降のSSLの処理を停止します。
再ネゴシエーションのたびにこのコールバックが呼び出されるため、
何らかの理由で再ネゴシエーションを禁止したい場合などに利用できます。
nil を渡すとコールバックは無効になります。
以下の例は再ネゴシエーションを一切禁止します。
num_handshakes = 0
ctx.renegotiation_cb = lambd... -
Matrix
# laplace _ expansion(row: nil , column: nil) -> object | Integer | Rational | Float (29122.0) -
row 行、もしくは column 列に関するラプラス展開をする。
row 行、もしくは column 列に関するラプラス展開をする。
通常の行列に対してはこれは単に固有値を計算するだけです。かわりにMatrix#determinant を
利用すべきです。
変則的な形状の行列に対してはそれ以上の意味を持ちます。例えば
row行/column列が行列やベクトルである場合には
//emlist[例][ruby]{
require 'matrix'
# Matrix[[7,6], [3,9]].laplace_expansion(column: 1) # => 45
Matrix[[Vector[1, 0], Vector[0, 1]], [2, 3]].... -
OpenSSL
:: OCSP :: BasicResponse # status -> [[OpenSSL :: OCSP :: CertificateId , Integer , Integer , Time|nil , Time , Time|nil , [OpenSSL :: X509 :: Extension]]] (28810.0) -
証明書の状態の問い合わせの結果を返します。
証明書の状態の問い合わせの結果を返します。
この返り値には複数の問い合わせ結果が含まれています。
個々の結果は以下の内容の配列です。
[ 問い合わせの CertificateId オブジェクト,
ステータスコード,
失効理由コード,
失効時刻,
最終更新時刻,
次回更新時刻,
拡張領域 ]
ステータスコードはいかのいずれかの値を取ります
* OpenSSL::OCSP::V_CERTSTATUS_GOOD 正常
* OpenSSL::OCSP::V_CERTSTATUS_REVOKED 失効
* OpenSSL::OCSP::... -
Enumerator
:: Lazy # slice _ before(initial _ state) {|elt , state| bool } -> Enumerator :: Lazy (28582.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
OpenSSL
:: SSL :: SSLContext # client _ ca -> [OpenSSL :: X509 :: Certificate] | OpenSSL :: X509 :: Certificate | nil (28510.0) -
クライアント証明書を要求する時にクライアントに送る CA のリスト を返します。
クライアント証明書を要求する時にクライアントに送る CA のリスト
を返します。
@see OpenSSL::SSL::SSLContext#client_ca= -
Pathname
# each _ child(with _ directory = true) {|pathname| . . . } -> [Pathname] (28243.0) -
self.children(with_directory).each と同じです。
self.children(with_directory).each と同じです。
@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us... -
OpenSSL
:: PKCS7 # certificates -> [OpenSSL :: X509 :: Certificate] | nil (28207.0) -
署名に添付される証明書を配列で返します。
署名に添付される証明書を配列で返します。 -
OpenSSL
:: X509 :: ExtensionFactory # issuer _ certificate -> OpenSSL :: X509 :: Certificate | nil (28207.0) -
自身に設定されている発行者(issuer)の証明書オブジェクトを返します。
自身に設定されている発行者(issuer)の証明書オブジェクトを返します。
証明書が設定されていない場合は nil を返します。 -
OpenSSL
:: X509 :: ExtensionFactory # subject _ certificate -> OpenSSL :: X509 :: Certificate | nil (28207.0) -
自身に設定されている所有者(subject)の証明書オブジェクトを返します。
自身に設定されている所有者(subject)の証明書オブジェクトを返します。
証明書が設定されていない場合は nil を返します。 -
REXML
:: DocType # attribute _ of(element , attribute) -> String | nil (28207.0) -
DTD 内の属性リスト宣言で、 element という名前の要素の attribute という 名前の属性のデフォルト値を返します。
DTD 内の属性リスト宣言で、 element という名前の要素の attribute という
名前の属性のデフォルト値を返します。
elementという名前の要素の属性値は宣言されていない、
elementという名前の要素にはattributeという名前の属性が宣言されていない、
もしくはデフォルト値が宣言されていない、のいずれかの場合は nil を返します。
@param element 要素名(文字列)
@param attribute 属性名(文字列)
//emlist[][ruby]{
require 'rexml/document'
doctype = REXML::Doc... -
REXML
:: DocType # notation(name) -> REXML :: NotationDecl | nil (28207.0) -
DTD に含まれている記法宣言 (REXML::NotationDecl) で name という名前を持つものを返します。
DTD に含まれている記法宣言 (REXML::NotationDecl) で
name という名前を持つものを返します。
name という名前を持つ記法宣言が存在しない場合は nil を返します。
@param name 検索する記法名 -
REXML
:: Element # attribute(name , namespace = nil) -> REXML :: Attribute | nil (28207.0) -
name で指定される属性を返します。
name で指定される属性を返します。
属性は REXML::Attribute オブジェクトの形で返します。
name は "foo:bar" のように prefix を指定することができます。
namespace で名前空間の URI を指定することで、その名前空間内で
name という属性名を持つ属性を指定できます。
指定した属性名の属性がない場合は nil を返します。
@param name 属性名(文字列)
@param namespace 名前空間のURI(文字列)
//emlist[][ruby]{
require 'rexml/document'
doc = R... -
Rational
# truncate(precision = 0) -> Rational | Integer (28207.0) -
小数点以下を切り捨てて値を整数に変換します。
小数点以下を切り捨てて値を整数に変換します。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(2, 3).to_i # => 0
Rational(3).to_i # => 3
Rational(300.6).to_i # => 300
Rational(98, 71).to_i # => 1
Rational(-31, 2).to_i # => -15
//}
precision を指定した場合は指定した桁数で切り... -
Enumerable
# chunk _ while {|elt _ before , elt _ after| . . . } -> Enumerator (28051.0) -
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け た(グループ化した)要素を持つEnumerator を返します。
要素を前から順にブロックで評価し、その結果によって要素をチャンクに分け
た(グループ化した)要素を持つEnumerator を返します。
隣り合う値をブロックパラメータ elt_before、elt_after に渡し、ブロックの
評価値が偽になる所でチャンクを区切ります。
ブロックは self の長さ - 1 回呼び出されます。
@return チャンクごとの配列をブロックパラメータに渡す Enumerator
を返します。eachメソッドは以下のように呼び出します。
//emlist{
enum.chunk_while { |elt_before, elt_af... -
Enumerator
:: Lazy # collect {|item| . . . } -> Enumerator :: Lazy (27982.0) -
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#map と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.map{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:map>
1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8,... -
Enumerator
:: Lazy # find _ all {|item| . . . } -> Enumerator :: Lazy (27982.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # select {|item| . . . } -> Enumerator :: Lazy (27982.0) -
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#select と同じですが、配列ではなくEnumerator::Lazy を返します。
@raise ArgumentError ブロックを指定しなかった場合に発生します。
//emlist[例][ruby]{
1.step.lazy.find_all { |i| i.even? }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:find_all>
1.step.lazy.select { |i| i.even? }.take(10).force
# => [2, 4, 6,... -
Enumerator
:: Lazy # slice _ before {|elt| bool } -> Enumerator :: Lazy (27982.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # slice _ before(pattern) -> Enumerator :: Lazy (27982.0) -
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>
1.step.lazy.slice_before { |e| e % 3 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5], [6... -
Enumerator
:: Lazy # drop _ while {|item| . . . } -> Enumerator :: Lazy (27979.0) -
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#drop_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.drop_while { |i| i < 42 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:drop_while>
1.step.lazy.drop_while { |i| i < 42 }.take(10).force
# => [42, 43, 44, 45, 46, 47, 48, 49, 50, 51]
//... -
Enumerator
:: Lazy # slice _ after {|elt| bool } -> Enumerator :: Lazy (27979.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ after(pattern) -> Enumerator :: Lazy (27979.0) -
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>
1.step.lazy.slice_after { |e| e % 3 == 0 }.take(5).force
# => [[1, 2, 3], [4, 5, 6], [... -
Enumerator
:: Lazy # slice _ when {|elt _ before , elt _ after| bool } -> Enumerator :: Lazy (27979.0) -
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }.take(5).force
# => [[1, 2]... -
Enumerator
:: Lazy # take _ while {|item| . . . } -> Enumerator :: Lazy (27979.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (27961.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
IO.foreach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\... -
Matrix
# collect {|x| . . . } -> Matrix (27946.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each -
Float
# angle -> 0 | Float (27913.0) -
自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。
自身の偏角(正の数なら 0、負の数なら Math::PI)を返します。
//emlist[例][ruby]{
1.arg # => 0
-1.arg # => 3.141592653589793
//}
ただし、自身が NaN(Not a number) であった場合は、NaN を返します。 -
GetoptLong
# terminated? -> true | false (27907.0) -
エラーが起きずにオプションの処理が終了しているときは真が 返ります。それ以外のときは、偽が返ります。
エラーが起きずにオプションの処理が終了しているときは真が
返ります。それ以外のときは、偽が返ります。 -
LoadError
# path -> String | nil (27907.0) -
Kernel.#require や Kernel.#load に失敗したパスを返します。
Kernel.#require や Kernel.#load に失敗したパスを返します。
begin
require 'this/file/does/not/exist'
rescue LoadError => e
e.path # => 'this/file/does/not/exist'
end
パスが定まらない場合は nil を返します。 -
Matrix
:: LUPDecomposition # solve(b) -> Vector | Matrix (27907.0) -
self が正方行列 A の LUP 分解の時、一次方程式 Ax = b の解を返します。 b には Vector, Matrix, 数値の配列を指定出来ます。
self が正方行列 A の LUP 分解の時、一次方程式 Ax = b の解を返します。
b には Vector, Matrix, 数値の配列を指定出来ます。
それぞれベクトルのサイズ、行列の行数、配列のサイズが A の列数と一致していなければなりません。
返り値は b が行列なら行列、それ以外はベクトルになります。
@param b 一次方程式の定数項を指定します。
//emlist[][ruby]{
require 'matrix'
lup = Matrix[[2, 1], [1, 2]].lup
lup.solve([1, -1]) #=> ... -
Net
:: FTP :: MLSxEntry # create -> Time|nil (27907.0) -
エントリの作成時刻を返します。
エントリの作成時刻を返します。
情報がない場合は nil を返します。 -
Net
:: IMAP :: Envelope # date -> String | nil (27907.0) -
日付の文字列を返します。
日付の文字列を返します。
エンベロープに存在しないときは nil を返します。 -
OpenSSL
:: PKey :: EC # private _ key -> OpenSSL :: BN|nil (27907.0) -
秘密鍵となる整数を返します。
秘密鍵となる整数を返します。
鍵が設定されていない場合は nil を返します。
@see OpenSSL::PKey::EC#private_key= -
Process
:: Status # exitstatus -> Integer | nil (27907.0) -
exited? が真の場合プロセスが返した終了ステータスの整数を、そ うでない場合は nil を返します。
exited? が真の場合プロセスが返した終了ステータスの整数を、そ
うでない場合は nil を返します。 -
REXML
:: Entity # ndata -> String | nil (27907.0) -
解析対象外実体(unparsed entity)宣言である場合には その記法名(notation name)を返します。
解析対象外実体(unparsed entity)宣言である場合には
その記法名(notation name)を返します。
それ以外の場合は nil を返します。 -
Rational
# ceil(precision = 0) -> Integer | Rational (27907.0) -
自身と等しいかより大きな整数のうち最小のものを返します。
自身と等しいかより大きな整数のうち最小のものを返します。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).ceil # => 3
Rational(2, 3).ceil # => 1
Rational(-3, 2).ceil # => -1
//}
precision を指定した場合は指定した桁数の数値と、上述の性質に最も近い整
数か Rational を返します。
//emlist[例][ruby]{
Ra... -
Rational
# floor(precision = 0) -> Integer | Rational (27907.0) -
自身と等しいかより小さな整数のうち最大のものを返します。
自身と等しいかより小さな整数のうち最大のものを返します。
@param precision 計算結果の精度
@raise TypeError precision に整数以外のものを指定すると発生します。
//emlist[例][ruby]{
Rational(3).floor # => 3
Rational(2, 3).floor # => 0
Rational(-3, 2).floor # => -2
//}
Rational#to_i とは違う結果を返す事に注意してください。
//emlist[例][ruby]{
Rational(+7, 4).to_i # => ... -
Symbol
# match(other) -> Integer | nil (27907.0) -
正規表現 other とのマッチを行います。
正規表現 other とのマッチを行います。
(self.to_s.match(other) と同じです。)
@param other 比較対象のシンボルを指定します。
@return マッチが成功すればマッチした位置を、そうでなければ nil を返します。
p :foo.match(/foo/) # => 0
p :foobar.match(/bar/) # => 3
p :foo.match(/bar/) # => nil
@see String#match -
Tempfile
# path -> String | nil (27907.0) -
テンポラリファイルのパス名を返します。
テンポラリファイルのパス名を返します。
Tempfile#close! を実行後だった場合にはnilを返します。
require "tempfile"
tf = Tempfile.new("hoo")
p tf.path # => "/tmp/hoo.10596.0"
tf.close!
p tf.path # => nil -
Shell
# cat(*files) -> Shell :: Filter (27730.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "al... -
Shell
:: CommandProcessor # cat(*files) -> Shell :: Filter (27730.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "al... -
Shell
:: Filter # cat(*files) -> Shell :: Filter (27730.0) -
実行すると, それらを内容とする Filter オブジェクトを返します.
実行すると, それらを内容とする Filter オブジェクトを返します.
@param files シェルコマンド cat に与えるファイル名を文字列で指定します。
動作例
require 'shell'
Shell.def_system_command("head")
sh = Shell.new
sh.transact {
glob("*.txt").to_a.each { |file|
file.chomp!
cat(file).each { |l|
echo(l) | tee(file + ".tee") >> "al... -
Enumerator
:: Lazy # take _ while -> Enumerator :: Lazy (27679.0) -
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
Enumerable#take_while と同じですが、配列ではなくEnumerator::Lazy を返します。
//emlist[例][ruby]{
1.step.lazy.zip(('a'..'z').cycle).take_while { |e| e.first < 100_000 }
# => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1:step>>:zip(#<Enumerator: "a".."z":cycle>)>:take_while>
1.step.lazy.... -
Pathname
# each _ line(*args) -> Enumerator (27661.0) -
IO.foreach(self.to_s, *args, &block) と同じです。
IO.foreach(self.to_s, *args, &block) と同じです。
//emlist[例][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\n")
Pathname("testfile").each_line
# => #<Enumerator: IO:foreach("testfile")>
//}
//emlist[例 ブロックを指定][ruby]{
require "pathname"
IO.write("testfile", "line1\nline2,\nline3\... -
Enumerable
# cycle(n=nil) -> Enumerator (27646.0) -
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し ブロックを呼びだします。
Enumerable オブジェクトの各要素を n 回 or 無限回(n=nil)繰り返し
ブロックを呼びだします。
n に 0 もしくは負の値を渡した場合は何もしません。
繰り返しが最後まで終了した場合(つまりbreakなどで中断しなかった場合)
は nil を返します。
このメソッドは内部の配列に各要素を保存しておくため、
一度 Enumerable の終端に到達した後に自分自身を変更しても
このメソッドの動作に影響を与えません。
//emlist[例][ruby]{
a = ["a", "b", "c"]
a.cycle {|x| puts x } # print, a, b, c,... -
Matrix
# collect -> Enumerator (27646.0) -
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
行列の各要素に対してブロックの適用を繰り返した結果を、要素として持つ行列を生成します。
ブロックがない場合、 Enumerator を返します。
//emlist[例][ruby]{
require 'matrix'
m = Matrix[[1, 2], [3, 4]]
p m.map { |x| x + 100 } # => Matrix[[101, 102], [103, 104]]
//}
@see Matrix#each -
Matrix
# column(j) -> Vector | nil (27646.0) -
j 番目の列を Vector オブジェクトで返します。 j 番目の列が存在しない場合は nil を返します。 ブロックが与えられた場合はその列の各要素についてブロックを繰り返します。
j 番目の列を Vector オブジェクトで返します。
j 番目の列が存在しない場合は nil を返します。
ブロックが与えられた場合はその列の各要素についてブロックを繰り返します。
@param j 列の位置を指定します。
先頭の列が 0 番目になります。j の値が負の時には末尾から
のインデックスと見倣します。末尾の列が -1 番目になります。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matr... -
Matrix
# column(j) {|x| . . . } -> self (27646.0) -
j 番目の列を Vector オブジェクトで返します。 j 番目の列が存在しない場合は nil を返します。 ブロックが与えられた場合はその列の各要素についてブロックを繰り返します。
j 番目の列を Vector オブジェクトで返します。
j 番目の列が存在しない場合は nil を返します。
ブロックが与えられた場合はその列の各要素についてブロックを繰り返します。
@param j 列の位置を指定します。
先頭の列が 0 番目になります。j の値が負の時には末尾から
のインデックスと見倣します。末尾の列が -1 番目になります。
//emlist[例][ruby]{
require 'matrix'
a1 = [ 1, 2, 3]
a2 = [10, 15, 20]
a3 = [-1, -2, 1.5]
m = Matr... -
Pathname
# each _ child(with _ directory = true) -> Enumerator (27643.0) -
self.children(with_directory).each と同じです。
self.children(with_directory).each と同じです。
@param with_directory 偽を指定するとファイル名のみ返します。デフォルトは真です。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_child {|f| p f }
# => #<Pathname:/usr/local/bin>
# => #<Pathname:/usr/local/etc>
# => #<Pathname:/usr/local/include>
# => #<Pathname:/us... -
File
# truncate(length) -> 0 (27640.0) -
ファイルのサイズを最大 length バイトにします。
ファイルのサイズを最大 length バイトにします。
サイズの変更に成功すれば 0 を返します。失敗した場合は例外
Errno::EXXX が発生します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX サイズの変更に失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "1234567890")
File.open("testfile", "a") do |f|
f.truncate(5) # => 0
f.size # => 5... -
Module
# append _ features(module _ or _ class) -> self (27640.0) -
モジュール(あるいはクラス)に self の機能を追加します。
モジュール(あるいはクラス)に self の機能を追加します。
このメソッドは Module#include の実体であり、
include を Ruby で書くと以下のように定義できます。
//emlist[例][ruby]{
def include(*modules)
modules.reverse_each do |mod|
# append_features や included はプライベートメソッドなので
# 直接 mod.append_features(self) などとは書けない
mod.__send__(:append_features, s... -
Enumerable
# collect -> Enumerator (27628.0) -
各要素に対してブロックを評価した結果を全て含む配列を返します。
各要素に対してブロックを評価した結果を全て含む配列を返します。
ブロックを省略した場合は Enumerator を返します。
//emlist[例][ruby]{
# すべて 3 倍にした配列を返す
p (1..3).map {|n| n * 3 } # => [3, 6, 9]
p (1..3).collect { "cat" } # => ["cat", "cat", "cat"]
//}
@see Array#collect, Array#map -
Enumerable
# drop _ while -> Enumerator (27625.0) -
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。
ブロックを評価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。
ブロックを指定しなかった場合は、Enumerator を返します。
//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
//} -
Enumerable
# take _ while -> Enumerator (27625.0) -
Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。
Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}
ブロックを省略した場合は Enumerator を返します。
@see Array#take_while -
Pathname
# each _ filename {|v| . . . } -> nil (27625.0) -
self のパス名要素毎にブロックを実行します。
self のパス名要素毎にブロックを実行します。
//emlist[例][ruby]{
require 'pathname'
Pathname.new("/foo/../bar").each_filename {|v| p v}
# => "foo"
# ".."
# "bar"
//} -
Logger
# formatter=(formatter) (27622.0) -
ログを出力する際に使用するフォーマッターをセットします。
ログを出力する際に使用するフォーマッターをセットします。
@param formatter 4 つの引数 (severity, time, program name, message) を受け取る call メソッドを
持つオブジェクトを指定します。call メソッドの返り値は文字列にしてください。
//emlist[][ruby]{
require 'logger'
logger = Logger.new
logger.formatter = proc{|severity, datetime, progname, message|
"#{datet... -
Gem
:: Specification # default _ executable -> String | nil (27607.0) -
Gem パッケージ内で gem コマンド経由で実行するファイルを返します。
Gem パッケージ内で gem コマンド経由で実行するファイルを返します。 -
REXML
:: NotationDecl # public -> String | nil (27607.0) -
公開識別子を返します。
公開識別子を返します。
宣言が公開識別子を含まない場合は nil を返します。 -
WEBrick
:: HTTPUtils :: FormData # filename -> String | nil (27607.0) -
フォームデータの filename 属性を文字列で表すアクセサです。
フォームデータの filename 属性を文字列で表すアクセサです。
@param value フォームデータの filename 属性を文字列で指定します。
例:
require "webrick/cgi"
class MyCGI < WEBrick::CGI
def do_GET(req, res)
p req.query['q'].filename #=> "my_file.txt"
end
end
MyCGI.new.start() -
File
# path -> String (27376.0) -
オープン時に使用したパスを文字列で返します。
オープン時に使用したパスを文字列で返します。
パスは self に対応するファイルを指しているとは限りません。
たとえば、ファイルが移動されていたり、削除されていたり、
File::Constants::TMPFILEオプション付きで作成されていたりする場合です。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f.path } #=> "/tmp/.....