ライブラリ
- ビルトイン (109)
- benchmark (1)
- bigdecimal (5)
-
bigdecimal
/ util (1) - csv (4)
- date (1)
- digest (2)
- erb (1)
- fiddle (12)
-
fiddle
/ import (1) - ipaddr (3)
-
irb
/ context (5) - json (1)
- matrix (2)
- openssl (33)
- optparse (4)
- ostruct (2)
- pathname (70)
-
racc
/ parser (1) - rake (7)
- resolv (3)
- rexml (1)
-
rexml
/ document (29) -
rubygems
/ package / tar _ header (1) -
rubygems
/ platform (1) -
rubygems
/ requirement (1) -
rubygems
/ version (2) - scanf (2)
- set (4)
-
shell
/ filter (2) - socket (4)
- stringio (2)
- uri (6)
-
webrick
/ httprequest (1) -
webrick
/ httpresponse (7) -
webrick
/ httputils (1) -
webrick
/ httpversion (1) -
webrick
/ log (6) -
win32
/ registry (2) - win32ole (12)
- zlib (2)
クラス
-
ARGF
. class (3) - Addrinfo (2)
- Array (7)
- BasicObject (1)
-
Benchmark
:: Tms (1) - BigDecimal (6)
-
CGI
:: Cookie (1) -
CSV
:: Row (2) -
CSV
:: Table (2) - Complex (1)
- Date (1)
-
Digest
:: Base (2) - ERB (1)
- Encoding (2)
-
Enumerator
:: Lazy (2) - Exception (2)
- FalseClass (2)
-
Fiddle
:: Pointer (12) - Float (4)
-
Gem
:: Package :: TarHeader (1) -
Gem
:: Platform (1) -
Gem
:: Requirement (1) -
Gem
:: Version (2) - Hash (10)
- IO (3)
- IPAddr (3)
-
IRB
:: Context (5) - Integer (2)
- MatchData (1)
- Matrix (1)
- Method (2)
- Module (3)
- NameError (1)
- NilClass (1)
- Object (6)
-
OpenSSL
:: BN (1) -
OpenSSL
:: Config (1) -
OpenSSL
:: HMAC (3) -
OpenSSL
:: Netscape :: SPKI (2) -
OpenSSL
:: PKCS7 (2) -
OpenSSL
:: PKey :: DH (3) -
OpenSSL
:: PKey :: DSA (6) -
OpenSSL
:: PKey :: RSA (6) -
OpenSSL
:: X509 :: CRL (2) -
OpenSSL
:: X509 :: Certificate (2) -
OpenSSL
:: X509 :: Extension (1) -
OpenSSL
:: X509 :: Name (1) -
OpenSSL
:: X509 :: Request (2) - OpenStruct (2)
- OptionParser (2)
-
OptionParser
:: ParseError (2) - Pathname (70)
- Proc (2)
-
Process
:: Status (1) -
REXML
:: Attribute (2) -
REXML
:: CData (2) -
REXML
:: Child (2) -
REXML
:: Comment (2) -
REXML
:: Declaration (1) -
REXML
:: DocType (1) -
REXML
:: Element (6) -
REXML
:: Elements (5) -
REXML
:: Entity (2) -
REXML
:: ExternalEntity (1) -
REXML
:: NotationDecl (1) -
REXML
:: ParseException (1) -
REXML
:: Text (3) -
Racc
:: Parser (1) -
Rake
:: EarlyTime (1) -
Rake
:: FileList (1) -
Rake
:: InvocationChain (1) -
Rake
:: InvocationChain :: EmptyInvocationChain (1) -
Rake
:: Task (1) -
Rake
:: TaskArguments (2) - Range (2)
- Rational (2)
- Regexp (2)
-
Resolv
:: DNS :: Name (1) -
Resolv
:: IPv4 (1) -
Resolv
:: IPv6 (1) -
Scanf
:: FormatSpecifier (1) -
Scanf
:: FormatString (1) - Set (2)
-
Shell
:: Filter (2) -
Socket
:: Option (2) - String (9)
- StringIO (2)
- Struct (2)
- Symbol (24)
- Thread (4)
-
Thread
:: Backtrace :: Location (2) - Time (1)
- TrueClass (1)
-
URI
:: Generic (6) - UnboundMethod (3)
- UncaughtThrowError (1)
- Vector (1)
-
WEBrick
:: BasicLog (6) -
WEBrick
:: Cookie (1) -
WEBrick
:: HTTPRequest (1) -
WEBrick
:: HTTPResponse (7) -
WEBrick
:: HTTPUtils :: FormData (1) -
WEBrick
:: HTTPVersion (1) -
WIN32OLE
_ EVENT (1) -
WIN32OLE
_ METHOD (2) -
WIN32OLE
_ PARAM (2) -
WIN32OLE
_ TYPE (3) -
WIN32OLE
_ TYPELIB (2) -
WIN32OLE
_ VARIABLE (2) -
Win32
:: Registry (2) -
Zlib
:: GzipWriter (2)
モジュール
- Enumerable (2)
-
Fiddle
:: Importer (1) -
JSON
:: Generator :: GeneratorMethods :: Object (1) -
OpenSSL
:: Buffering (1) -
REXML
:: Node (1)
キーワード
- % (2)
- +@ (1)
- -@ (1)
- << (5)
- =~ (1)
- [] (7)
- []= (4)
-
_ _ to _ s _ _ (1) - add (1)
-
add
_ element (1) -
add
_ namespace (2) -
add
_ trace _ func (1) - atime (1)
- basename (1)
- bind (1)
- binread (1)
- binwrite (1)
- birthtime (1)
- blockdev? (1)
- body= (1)
- capitalize (1)
- chardev? (1)
- chmod (1)
- chown (1)
- chunked= (1)
-
content
_ length (1) -
content
_ length= (1) - ctime (1)
- data (1)
- debug (1)
-
define
_ singleton _ method (2) - delete (1)
-
delete
_ all (1) -
delete
_ element (1) -
delete
_ namespace (1) - directory? (1)
- dirname (1)
- downcase (1)
-
each
_ entry (1) -
each
_ line (2) - empty? (1)
- entities (1)
- error (1)
- executable? (1)
-
executable
_ real? (1) - exist? (1)
- export (5)
- extname (1)
- fatal (1)
- file? (1)
- find (2)
- fnmatch (1)
- fnmatch? (1)
- ftype (1)
- grep (1)
-
grep
_ v (1) - grpowned? (1)
- handler= (1)
- help (1)
- hex (1)
- hexdigest (2)
- hostname= (1)
-
http
_ version (1) - id2name (1)
- info (1)
- inspect (22)
- inspect? (1)
-
inspect
_ mode= (1) - intern (1)
- join (1)
- lchmod (1)
- lchown (1)
- length (1)
- lstat (1)
-
make
_ link (1) -
make
_ symlink (1) - match (1)
- merge! (1)
-
method
_ missing (1) - mkdir (1)
- mkpath (1)
- modulo (1)
- mtime (1)
- name (8)
- next (1)
-
next
_ float (1) -
next
_ sibling= (1) - normalize (1)
- normalize! (1)
- oct (1)
- open (2)
- opendir (2)
- owned? (1)
- owner (1)
- pipe? (1)
-
prev
_ float (1) -
previous
_ sibling= (1) - print (1)
- ptr (1)
- read (1)
- readable? (1)
-
readable
_ real? (1) - readlines (1)
- readlink (1)
- ref (1)
- remainder (1)
- rename (1)
- rmdir (1)
- rmtree (1)
-
set
_ trace _ func (1) - setgid? (1)
- setuid? (1)
- size (2)
- size? (1)
- slice (5)
- socket? (1)
- split (1)
- src (1)
- stat (1)
- sticky? (1)
- string (1)
- succ (2)
- swapcase (1)
- symlink? (1)
- sysopen (1)
- syswrite (1)
- text= (1)
-
to
_ csv (2) -
to
_ digits (1) -
to
_ f (1) -
to
_ i (1) -
to
_ json (1) -
to
_ path (1) -
to
_ pem (10) -
to
_ proc (1) -
to
_ set (2) -
to
_ sockaddr (1) -
to
_ str (4) -
to
_ string (2) -
to
_ sym (2) -
token
_ to _ str (1) -
transform
_ keys (2) -
transform
_ keys! (2) -
transform
_ values (2) -
transform
_ values! (2) - truncate (1)
- uniq (2)
- uniq! (2)
- upcase (1)
- userinfo= (1)
- utime (1)
- value (2)
- value= (1)
- version (1)
- warn (1)
-
world
_ readable? (1) -
world
_ writable? (1) - writable? (1)
-
writable
_ real? (1) - write (6)
-
yield
_ self (2) - zero? (1)
- | (1)
検索結果
先頭5件
-
WIN32OLE
_ TYPELIB # to _ s -> String (45307.0) -
TypeLibのドキュメント文字列を取得します。
TypeLibのドキュメント文字列を取得します。
ドキュメント文字列は、コンテキストヘルプなどに利用可能なTypeLibの簡単な
説明文で、通常バージョン番号を含みます。
@return TypeLibのドキュメント文字列を返します。
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
puts tlib.name # => 'Microsoft Excel 14.0 Object Library' -
WIN32OLE
_ VARIABLE # to _ s -> String (45307.0) -
変数名を取得します。
変数名を取得します。
@return 変数名を文字列で返します。
tobj = WIN32OLE_TYPE.new('Microsoft Excel 14.0 Object Library', 'XlSheetType')
variables = tobj.variables
variables.each do |variable|
puts "#{variable.name}" # => xlChart, xlDialogSheet, ...
end -
Win32
:: Registry # to _ s (45307.0) -
@todo
@todo
キーのフルパスを 'HKEY_CURRENT_USER\SOFTWARE\foo\bar'
のような形で返します。 -
String
# to _ str -> String (18379.0) -
self を返します。
self を返します。
//emlist[例][ruby]{
p "str".to_s # => "str"
p "str".to_str # => "str"
//}
このメソッドは、文字列を他のクラスのインスタンスと混ぜて処理したいときに有効です。
例えば返り値が文字列か nil であるメソッド some_method があるとき、
to_s メソッドを使うと以下のように統一的に処理できます。
//emlist[例][ruby]{
# some_method(5).downcase だと返り値が nil のときに
# エラーになるので to_s をはさむ
p some_... -
IPAddr
# to _ string -> String (18340.0) -
標準的な文字列表現に変換します。
標準的な文字列表現に変換します。
require 'ipaddr'
addr6 = IPAddr.new('::1')
addr6.to_s #=> "::1"
addr6.to_string #=> "0000:0000:0000:0000:0000:0000:0000:0001"
@see IPAddr#to_s -
Object
# to _ str -> String (18322.0) -
オブジェクトの String への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
オブジェクトの String への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。
説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。
このメソッドを定義する条件は、
* 文字列が使われるすべての場面で代置可能であるような、
* 文字列そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_str
'Edition'
end
end
it = Foo.new... -
Addrinfo
# to _ sockaddr -> String (18307.0) -
struct sockaddr をパックした形式の文字列に変換します。
struct sockaddr をパックした形式の文字列に変換します。
require 'socket'
Addrinfo.tcp("localhost", 80).to_sockaddr
#=> "\x02\x00\x00P\x7F\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00" -
IRB
:: Context # _ _ to _ s _ _ -> String (18307.0) -
自身を文字列表現にしたオブジェクトを返します。
自身を文字列表現にしたオブジェクトを返します。 -
Enumerable
# to _ set(klass = Set , *args) -> Set (18304.0) -
Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。
Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。
引数 klass を与えた場合、Set クラスの代わりに、指定した集合クラスの
インスタンスを作ります。
この引数を指定することで、SortedSet あるいはその他のユーザ定義の
集合クラスのインスタンスを作ることができます
(ここでいう集合クラスとは、Setとメソッド/クラスメソッドで互換性のあるクラスです)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。
@param klass 生成する集合クラスを指定します。
@param args 集合クラ... -
Enumerable
# to _ set(klass = Set , *args) {|o| . . . } -> Set (18304.0) -
Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。
Enumerable オブジェクトの要素から、新しい集合オブジェクトを作ります。
引数 klass を与えた場合、Set クラスの代わりに、指定した集合クラスの
インスタンスを作ります。
この引数を指定することで、SortedSet あるいはその他のユーザ定義の
集合クラスのインスタンスを作ることができます
(ここでいう集合クラスとは、Setとメソッド/クラスメソッドで互換性のあるクラスです)。
引数 args およびブロックは、集合オブジェクトを生成するための new
メソッドに渡されます。
@param klass 生成する集合クラスを指定します。
@param args 集合クラ... -
Fiddle
:: Pointer # to _ str -> String (18304.0) -
自身が指す領域から長さ len の文字列を複製して返します。
自身が指す領域から長さ len の文字列を複製して返します。
len を省略した場合は、self.size をその代わりに使います。
@param len 文字列の長さを整数で指定します。 -
Fiddle
:: Pointer # to _ str(len) -> String (18304.0) -
自身が指す領域から長さ len の文字列を複製して返します。
自身が指す領域から長さ len の文字列を複製して返します。
len を省略した場合は、self.size をその代わりに使います。
@param len 文字列の長さを整数で指定します。 -
REXML
:: Attribute # to _ string -> String (18304.0) -
"name='value'" という形式の文字列を返します。
"name='value'" という形式の文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
e = REXML::Element.new("el")
e.add_attribute("ns:r", "rval")
p e.attributes.get_attribute("r").to_string # => "ns:r='rval'"
//} -
Racc
:: Parser # token _ to _ str(t) (18304.0) -
@todo
@todo -
String
# to _ sym -> Symbol (9340.0) -
文字列に対応するシンボル値 Symbol を返します。
文字列に対応するシンボル値 Symbol を返します。
なお、このメソッドの逆にシンボルに対応する文字列を得るには
Symbol#to_s または Symbol#id2name を使います。
シンボル文字列にはヌルキャラクタ("\0")、空の文字列の使用も可能です。
//emlist[例][ruby]{
p "foo".intern # => :foo
p "foo".intern.to_s == "foo" # => true
//} -
Symbol
# to _ sym -> self (9304.0) -
self を返します。
self を返します。
例:
:foo.intern # => :foo
@see String#intern -
Gem
:: Version # version -> String (9025.0) -
バージョン情報を文字列として返します。
バージョン情報を文字列として返します。
//emlist[][ruby]{
version = Gem::Version.new("1.2.3a")
p version.to_s # => "1.2.3a"
p version.version # => "1.2.3a"
//} -
REXML
:: CData # value -> String (9025.0) -
テキスト文字列を返します。
テキスト文字列を返します。
@see REXML::Text#value, REXML::Text#to_s
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<root><![CDATA[foobar baz]]></root>
EOS
doc.root[0].class # => REXML::CData
doc.root[0].value # => "foobar baz"
//} -
Float
# inspect -> String (115.0) -
自身を人間が読みやすい形の文字列表現にして返します。
自身を人間が読みやすい形の文字列表現にして返します。
固定小数点、浮動小数点の形式か、 "Infinity"、"-Infinity"、"NaN" のいず
れかを返します。
@return 文字列を返します。
//emlist[例][ruby]{
0.00001.to_s # => "1.0e-05"
3.14.to_s # => "3.14"
10000_00000_00000.0.to_s # => "100000000000000.0"
10000_00000_00000_00000.0.to_s # => "1.0e+19"
... -
Pathname
# empty? -> bool (100.0) -
ディレクトリに対しては Dir.empty?(self.to_s) と同じ、他に対しては FileTest.empty?(self.to_s) と同じです。
ディレクトリに対しては Dir.empty?(self.to_s) と同じ、他に対しては FileTest.empty?(self.to_s) と同じです。
//emlist[例 ディレクトリの場合][ruby]{
require "pathname"
require 'tmpdir'
Pathname("/usr/local").empty? # => false
Dir.mktmpdir { |dir| Pathname(dir).empty? } # => true
//}
//emlist[例 ファイルの場合][ruby]{
require "path... -
REXML
:: Element # delete _ element(element) -> REXML :: Element (94.0) -
子要素を削除します。
子要素を削除します。
element で削除する要素を指定できます。整数、文字列、REXML::Element
オブジェクトのいずれかが指定できます。
REXML::Element を指定すると、その要素が削除されます。
整数を指定すると、element 番目の要素を削除します(1-originで指定します)。
文字列を指定すると、XPath としてマッチする要素を削除します。
複数の要素がマッチする場合はそのうち1つが削除されます。
@param element 削除する要素
@see REXML::Elements#delete
//emlist[][ruby]{
require... -
REXML
:: Element # text=(text) (94.0) -
「先頭の」テキストノードを text で置き換えます。
「先頭の」テキストノードを text で置き換えます。
テキストノードを1つ以上保持している場合はそのうち
最初のノードを置き換えます。
要素がテキストノードを保持していない場合は新たなテキストノードが追加されます。
text には文字列、REXML::Text、nil のいずれかが指定できます。
REXML::Text オブジェクトを指定した場合には、それが設定され、
文字列を指定した場合には
REXML::Text.new(text, whitespace(), nil, raw())
で生成される Text オブジェクトが設定されます。
nil を指定すると最初のテキストノードが削... -
Regexp
# inspect -> String (88.0) -
Regexp#to_s より自然な文字列を返します。
Regexp#to_s より自然な文字列を返します。
//emlist[例][ruby]{
p /^ugou.*?/i.to_s # => "(?i-mx:^ugou.*?)"
p /^ugou.*?/i.inspect # => "/^ugou.*?/i"
//}
@see Regexp#to_s -
Integer
# inspect(base=10) -> String (79.0) -
整数を 10 進文字列表現に変換します。
整数を 10 進文字列表現に変換します。
引数を指定すれば、それを基数とした文字列表
現に変換します。
//emlist[][ruby]{
p 10.to_s(2) # => "1010"
p 10.to_s(8) # => "12"
p 10.to_s(16) # => "a"
p 35.to_s(36) # => "z"
//}
@return 数値の文字列表現
@param base 基数となる 2 - 36 の数値。
@raise ArgumentError base に 2 - 36 以外の数値を指定した場合に発生します。 -
REXML
:: Elements # delete(element) -> Element (76.0) -
element で指定した子要素を取り除きます。
element で指定した子要素を取り除きます。
element には、REXML::Element、整数、文字列が指定できます。
Element オブジェクトを指定した場合は、その子要素を取り除きます。
整数を指定した場合には element 番目の子要素を削除します(1-originです)。
文字列を指定した場合は、削除する要素を XPath で指定します。
XPathが複数の要素を指している場合は、そのうち一つを削除します。
取り除かれた要素を返します。
XPath で指定した場合、子要素ではない要素も取り除けることに注意してください。
@param element 削除する要素... -
Thread
# set _ trace _ func(pr) -> Proc | nil (76.0) -
スレッドにトレース用ハンドラを設定します。
スレッドにトレース用ハンドラを設定します。
nil を渡すとトレースを解除します。
設定したハンドラを返します。
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
#... -
Pathname
# to _ path -> String (70.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s -
StringIO
# <<(obj) -> self (70.0) -
obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで 文字列に変換します。 self を返します。
obj を pos の位置に書き込みます。 必要なら obj.to_s を呼んで
文字列に変換します。 self を返します。
@param obj 自身に書き込みたい、文字列か to_s が定義されたオブジェクトを指定します。 -
WEBrick
:: BasicLog # <<(obj) -> () (70.0) -
指定された obj を to_s メソッドで文字列に変換してから、 ログレベル INFO でログに記録します。
指定された obj を to_s メソッドで文字列に変換してから、
ログレベル INFO でログに記録します。
@param obj 記録したいオブジェクトを指定します。文字列でない場合は to_s メソッドで文字列に変換します。
require 'webrick'
logger = WEBrick::BasicLog.new()
logger << 'hoge' -
Zlib
:: GzipWriter # write(*str) -> Integer (70.0) -
自身に str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。
自身に str を出力します。str が文字列でなけ
れば to_s による文字列化を試みます。
@param str 出力する文字列を指定します。文字列でない場合は to_s で文字列に変換します。
@return 実際に出力できたバイト数を返します。
require 'zlib'
filename='hoge1.gz'
fw = File.open(filename, "w")
Zlib::GzipWriter.wrap(fw, Zlib::BEST_COMPRESSION){|gz|
gz.write "foo"
}
fr = File.open... -
REXML
:: Element # add _ element(element , attrs = nil) -> Element (58.0) -
子要素を追加します。
子要素を追加します。
element として追加する要素を指定します。
REXML::Element オブジェクトもしくは文字列を指定します。
element として REXML::Element オブジェクトを指定した場合、それが追加されます。
文字列を指定した場合は、それを要素名とする要素を追加します。
attrs に { String => String } という Hash を渡すと、
追加する要素の属性を指定できます。
子要素の最後に追加されます。
返り値は追加された要素です。
@param element 追加する要素
@param attrs 追加する要素に設定する... -
REXML
:: Elements # []=(index , element) (58.0) -
集合に要素 element を追加/更新します。
集合に要素 element を追加/更新します。
index で要素の更新する位置を指定します。
index には整数、文字列が指定できます。
整数を指定した場合は index 番目の要素を変更します(1-originです)。
文字列の場合は XPath としてマッチした要素を更新します。
整数/文字列どちらの場合でも対応する要素が存在しない場合は、
末尾に追加されます。
@param index 要素を更新する位置
@param element 要素(REXML::Elementオブジェクト)
//emlist[][ruby]{
require 'rexml/document'
do... -
Thread
# add _ trace _ func(pr) -> Proc (58.0) -
スレッドにトレース用ハンドラを追加します。
スレッドにトレース用ハンドラを追加します。
追加したハンドラを返します。
@param pr トレースハンドラ(Proc オブジェクト)
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, ... -
URI
:: Generic # userinfo=(s) (58.0) -
自身の userinfo を設定します。
自身の userinfo を設定します。
@param s 自身の userinfo を "username" か "username:password" という形式の文字列、あるいは
[username, password] という形式の文字列の配列で指定します。
@raise URI::InvalidComponentError 不正な引数 s に対して発生します。
@raise URI::InvalidURIError userinfo と registry を同時に設定した場合に発生します。
例:
require 'uri'
u = URI.pars... -
ARGF
. class # write(str) -> Integer (52.0) -
処理対象のファイルに対して str を出力します。 str が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。
処理対象のファイルに対して str を出力します。
str が文字列でなければ to_s による文字列化を試みます。
実際に出力できたバイト数を返します。
c:ARGF#inplace時にのみ使用できます。
@param str 出力する文字列を指定します。
@see ARGF.class#to_write_io -
IO
# <<(object) -> self (52.0) -
object を出力します。object が文字列でない時にはメソッ ド to_s を用いて文字列に変換します。
object を出力します。object が文字列でない時にはメソッ
ド to_s を用いて文字列に変換します。
以下のような << の連鎖を使うことができます。
STDOUT << 1 << " is a " << Integer << "\n"
@param object 出力したいオブジェクトを与えます。
@raise Errno::EXXX 出力に失敗した場合に発生します。 -
IO
# syswrite(string) -> Integer (52.0) -
write(2) を用いて string を出力します。 string が文字列でなければ to_s による文字列化を試みます。 実際に出力できたバイト数を返します。
write(2) を用いて string を出力します。
string が文字列でなければ to_s による文字列化を試みます。
実際に出力できたバイト数を返します。
stdio を経由しないので他の出力メソッドと混用すると思わぬ動作
をすることがあります。
@param string 自身に書き込みたい文字列を指定します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
//emlist[例][ruby]{
File.open("testfile", "w+") do |... -
IO
# write(*str) -> Integer (52.0) -
IOポートに対して str を出力します。str が文字列でなけ れば to_s による文字列化を試みます。 実際に出力できたバイト数を返します。
IOポートに対して str を出力します。str が文字列でなけ
れば to_s による文字列化を試みます。
実際に出力できたバイト数を返します。
IO#syswrite を除く全ての出力メソッドは、最終的に
"write" という名のメソッドを呼び出すので、このメソッドを置き換える
ことで出力関数の挙動を変更することができます。
@param str 自身に書き込みたい文字列を指定します。
@raise IOError 自身が書き込み用にオープンされていなければ発生します。
@raise Errno::EXXX 出力に失敗した場合に発生します。
//emlist[例][ruby]... -
JSON
:: Generator :: GeneratorMethods :: Object # to _ json(state _ or _ hash = nil) -> String (52.0) -
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。
このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。
@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。
//emlist[例][ruby... -
Pathname
# atime -> Time (52.0) -
File.atime(self.to_s) を渡したものと同じです。
File.atime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.atime # => 2018-12-18 20:58:13 +0900
//}
@see File.atime -
Pathname
# basename(suffix = "") -> Pathname (52.0) -
Pathname.new(File.basename(self.to_s, suffix)) と同じです。
Pathname.new(File.basename(self.to_s, suffix)) と同じです。
@param suffix サフィックスを文字列で与えます。'.*' という文字列を与えた場合、'*' はワイルドカードとして働き
'.' を含まない任意の文字列にマッチします。
//emlist[例][ruby]{
require "pathname"
Pathname("ruby/ruby.c").basename #=> #<Pathname:"ruby.c">
Pathname("ruby/ruby.c").basename("... -
Pathname
# binread(*args) -> String | nil (52.0) -
IO.binread(self.to_s, *args)と同じです。
IO.binread(self.to_s, *args)と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("testfile")
pathname.binread # => "This is line one\nThis is line two\nThis is line three\nAnd so on...\n"
pathname.binread(20) # => "This is line one\nThi"
pathname.binread(20, 10) # => ... -
Pathname
# binwrite(string , offset=nil) -> Integer (52.0) -
IO.binwrite(self.to_s, *args)と同じです。
IO.binwrite(self.to_s, *args)と同じです。
@see IO.binwrite -
Pathname
# birthtime -> Time (52.0) -
File.birthtime(self.to_s) を渡したものと同じです。
File.birthtime(self.to_s) を渡したものと同じです。
@raise NotImplementedError Windows のような birthtime のない環境で発生します。
@see File.birthtime -
Pathname
# blockdev? -> bool (52.0) -
FileTest.blockdev?(self.to_s) と同じです。
FileTest.blockdev?(self.to_s) と同じです。
@see FileTest.#blockdev? -
Pathname
# chardev? -> bool (52.0) -
FileTest.chardev?(self.to_s) と同じです。
FileTest.chardev?(self.to_s) と同じです。
@see FileTest.#chardev? -
Pathname
# chmod(mode) -> Integer (52.0) -
File.chmod(mode, self.to_s) と同じです。
File.chmod(mode, self.to_s) と同じです。
@param mode ファイルのアクセス権限を整数で指定します。
@see File.chmod -
Pathname
# chown(owner , group) -> Integer (52.0) -
File.chown(owner, group, self.to_s) と同じです。
File.chown(owner, group, self.to_s) と同じです。
@param owner オーナーを指定します。
@param group グループを指定します。
//emlist[例][ruby]{
require 'pathname'
Pathname('testfile').stat.uid # => 501
Pathname('testfile').chown(502, 12)
Pathname('testfile').stat.uid # => 502
//}
@see File.chown, File#chown -
Pathname
# ctime -> Time (52.0) -
File.ctime(self.to_s) を渡したものと同じです。
File.ctime(self.to_s) を渡したものと同じです。
//emlist[例][ruby]{
require 'pathname'
IO.write("testfile", "test")
pathname = Pathname("testfile")
pathname.ctime # => 2019-01-14 00:39:51 +0900
sleep 1
pathname.chmod(0755)
pathname.ctime # => 2019-01-14 00:39:52 +0900
//}
@see File.ctime -
Pathname
# directory? -> bool (52.0) -
FileTest.directory?(self.to_s) と同じです。
FileTest.directory?(self.to_s) と同じです。
@see FileTest.#directory? -
Pathname
# dirname -> Pathname (52.0) -
Pathname.new(File.dirname(self.to_s)) と同じです。
Pathname.new(File.dirname(self.to_s)) と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname('/usr/bin/shutdown').dirname # => #<Pathname:/usr/bin>
//}
@see File.dirname -
Pathname
# each _ entry {|pathname| . . . } -> nil (52.0) -
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。
//emlist[例][ruby]{
require "pathname"
Pathname("/usr/local").each_entry {|f| p f }
# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}
@... -
Pathname
# each _ line(*args) -> Enumerator (52.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\... -
Pathname
# each _ line(*args) {|line| . . . } -> nil (52.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\... -
Pathname
# executable? -> bool (52.0) -
FileTest.executable?(self.to_s) と同じです。
FileTest.executable?(self.to_s) と同じです。
@see FileTest.#executable? -
Pathname
# executable _ real? -> bool (52.0) -
FileTest.executable_real?(self.to_s) と同じです。
FileTest.executable_real?(self.to_s) と同じです。
@see FileTest.#executable_real? -
Pathname
# exist? -> bool (52.0) -
FileTest.exist?(self.to_s) と同じです。
FileTest.exist?(self.to_s) と同じです。
@see FileTest.#exist? -
Pathname
# expand _ path(default _ dir = & # 39; . & # 39;) -> Pathname (52.0) -
Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
Pathname.new(File.expand_path(self.to_s, *args)) と同じです。
@param default_dir self が相対パスであれば default_dir を基準に展開されます。
//emlist[例][ruby]{
require "pathname"
path = Pathname("testfile")
Pathname.pwd # => #<Pathname:/path/to>
path.expand_path # => #<Pathname:/path/to/testfile>
path.e... -
Pathname
# extname -> String (52.0) -
File.extname(self.to_s) と同じです。
File.extname(self.to_s) と同じです。
@see File.extname -
Pathname
# file? -> bool (52.0) -
FileTest.file?(self.to_s) と同じです。
FileTest.file?(self.to_s) と同じです。
@see FileTest.#file? -
Pathname
# fnmatch(pattern , *args) -> bool (52.0) -
File.fnmatch(pattern, self.to_s, *args) と同じです。
File.fnmatch(pattern, self.to_s, *args) と同じです。
@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。
@param args File.fnmatch を参照してください。
//emlist[例][ruby]{
require "pathname"
path = Pathname("testfile")
path.fnmatch("test*") ... -
Pathname
# fnmatch?(pattern , *args) -> bool (52.0) -
File.fnmatch?(pattern, self.to_s, *args) と同じです。
File.fnmatch?(pattern, self.to_s, *args) と同じです。
@param pattern パターンを文字列で指定します。ワイルドカードとして `*', `?', `[]' が使用できま
す。Dir.glob とは違って `{}' や `**/' は使用できません。
@param args File.fnmatch を参照してください。
@see File.fnmatch? -
Pathname
# ftype -> String (52.0) -
File.ftype(self.to_s) と同じです。
File.ftype(self.to_s) と同じです。
@see File.ftype -
Pathname
# grpowned? -> bool (52.0) -
FileTest.grpowned?(self.to_s) と同じです。
FileTest.grpowned?(self.to_s) と同じです。
@see FileTest.#grpowned? -
Pathname
# lchmod(mode) -> Integer (52.0) -
File.lchmod(mode, self.to_s) と同じです。
File.lchmod(mode, self.to_s) と同じです。
@param mode ファイルのアクセス権限を整数で指定します。
@see File.lchmod -
Pathname
# lchown(owner , group) -> Integer (52.0) -
File.lchown(owner, group, self.to_s) と同じです。
File.lchown(owner, group, self.to_s) と同じです。
@param owner オーナーを指定します。
@param group グループを指定します。
@see File.lchown -
Pathname
# lstat -> File :: Stat (52.0) -
File.lstat(self.to_s) と同じです。
File.lstat(self.to_s) と同じです。
@see File.lstat -
Pathname
# make _ link(old) -> 0 (52.0) -
File.link(old, self.to_s) と同じです。
File.link(old, self.to_s) と同じです。
@see File.link -
Pathname
# make _ symlink(old) -> 0 (52.0) -
File.symlink(old, self.to_s) と同じです。
File.symlink(old, self.to_s) と同じです。
@see File.symlink -
Pathname
# mkdir(*args) -> 0 (52.0) -
Dir.mkdir(self.to_s, *args) と同じです。
Dir.mkdir(self.to_s, *args) と同じです。
@see Dir.mkdir -
Pathname
# mkpath -> nil (52.0) -
FileUtils.mkpath(self.to_s) と同じです。
FileUtils.mkpath(self.to_s) と同じです。
@see FileUtils.#mkpath -
Pathname
# mtime -> Time (52.0) -
File.mtime(self.to_s) を渡したものと同じです。
File.mtime(self.to_s) を渡したものと同じです。
@see File.mtime -
Pathname
# open(mode = & # 39;r& # 39; , perm = 0666) -> File (52.0) -
File.open(self.to_s, *args, &block) と同じです。
File.open(self.to_s, *args, &block) と同じです。
@see File.open -
Pathname
# open(mode = & # 39;r& # 39; , perm = 0666) {|file| . . . } -> object (52.0) -
File.open(self.to_s, *args, &block) と同じです。
File.open(self.to_s, *args, &block) と同じです。
@see File.open -
Pathname
# opendir -> Dir (52.0) -
Dir.open(self.to_s, &block) と同じです。
Dir.open(self.to_s, &block) と同じです。
@see Dir.open -
Pathname
# opendir {|dir| . . . } -> nil (52.0) -
Dir.open(self.to_s, &block) と同じです。
Dir.open(self.to_s, &block) と同じです。
@see Dir.open -
Pathname
# owned? -> bool (52.0) -
FileTest.owned?(self.to_s) と同じです。
FileTest.owned?(self.to_s) と同じです。
@see FileTest.#owned? -
Pathname
# pipe? -> bool (52.0) -
FileTest.pipe?(self.to_s) と同じです。
FileTest.pipe?(self.to_s) と同じです。
@see FileTest.#pipe? -
Pathname
# read(*args) -> String | nil (52.0) -
IO.read(self.to_s, *args)と同じです。
IO.read(self.to_s, *args)と同じです。
@see IO.read -
Pathname
# readable? -> bool (52.0) -
FileTest.readable?(self.to_s) と同じです。
FileTest.readable?(self.to_s) と同じです。
@see FileTest.#readable? -
Pathname
# readable _ real? -> bool (52.0) -
FileTest.readable_real?(self.to_s) と同じです。
FileTest.readable_real?(self.to_s) と同じです。
@see FileTest.#readable_real? -
Pathname
# readlines(*args) -> [String] (52.0) -
IO.readlines(self.to_s, *args)と同じです。
IO.readlines(self.to_s, *args)と同じです。
@see IO.readlines -
Pathname
# readlink -> Pathname (52.0) -
Pathname.new(File.readlink(self.to_s)) と同じです。
Pathname.new(File.readlink(self.to_s)) と同じです。
@see File.readlink -
Pathname
# rename(to) -> 0 (52.0) -
File.rename(self.to_s, to) と同じです。
File.rename(self.to_s, to) と同じです。
@param to ファイル名を表す文字列を指定します。
@see File.rename -
Pathname
# rmdir -> 0 (52.0) -
Dir.rmdir(self.to_s) と同じです。
Dir.rmdir(self.to_s) と同じです。
@see Dir.rmdir -
Pathname
# rmtree -> nil (52.0) -
FileUtils.rm_r(self.to_s) と同じです。
FileUtils.rm_r(self.to_s) と同じです。
@see FileUtils.#rm_r -
Pathname
# setgid? -> bool (52.0) -
FileTest.setgid?(self.to_s) と同じです。
FileTest.setgid?(self.to_s) と同じです。
@see FileTest.#setgid? -
Pathname
# setuid? -> bool (52.0) -
FileTest.setuid?(self.to_s) と同じです。
FileTest.setuid?(self.to_s) と同じです。
@see FileTest.#setuid? -
Pathname
# size -> Integer (52.0) -
FileTest.size(self.to_s) と同じです。
FileTest.size(self.to_s) と同じです。
@see FileTest.#size -
Pathname
# size? -> bool (52.0) -
FileTest.size?(self.to_s) と同じです。
FileTest.size?(self.to_s) と同じです。
@see FileTest.#size? -
Pathname
# socket? -> bool (52.0) -
FileTest.socket?(self.to_s) と同じです。
FileTest.socket?(self.to_s) と同じです。
@see FileTest.#socket? -
Pathname
# split -> Array (52.0) -
File.split(self.to_s) と同じです。
File.split(self.to_s) と同じです。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/sample")
pathname.split # => [#<Pathname:/path/to>, #<Pathname:sample>]
//}
@see File.split -
Pathname
# stat -> File :: Stat (52.0) -
File.stat(self.to_s) と同じです。
File.stat(self.to_s) と同じです。
@see File.stat -
Pathname
# sticky? -> bool (52.0) -
FileTest.sticky?(self.to_s) と同じです。
FileTest.sticky?(self.to_s) と同じです。
@see FileTest.#sticky? -
Pathname
# symlink? -> bool (52.0) -
FileTest.symlink?(self.to_s) と同じです。
FileTest.symlink?(self.to_s) と同じです。
@see FileTest.#symlink? -
Pathname
# sysopen(*args) -> Integer (52.0) -
IO.sysopen(self.to_s, *args)と同じです。
IO.sysopen(self.to_s, *args)と同じです。
@see IO.sysopen -
Pathname
# truncate(length) -> 0 (52.0) -
File.truncate(self.to_s, length) と同じです。
File.truncate(self.to_s, length) と同じです。
@param length 変更したいサイズを整数で与えます。
@see File.truncate -
Pathname
# utime(atime , mtime) -> Integer (52.0) -
File.utime(atime, mtime, self.to_s) と同じです。
File.utime(atime, mtime, self.to_s) と同じです。
@param atime 最終アクセス時刻を Time か、起算時からの経過秒数を数値で指定します。
@param mtime 更新時刻を Time か、起算時からの経過秒数を数値で指定します。
@see File.utime -
Pathname
# world _ readable? -> bool (52.0) -
FileTest.world_readable?(self.to_s) と同じです。
FileTest.world_readable?(self.to_s) と同じです。
@see FileTest.#world_readable? -
Pathname
# world _ writable? -> bool (52.0) -
FileTest.world_writable?(self.to_s) と同じです。
FileTest.world_writable?(self.to_s) と同じです。
@see FileTest.#world_writable?