ライブラリ
- ビルトイン (18)
-
cgi
/ core (2) - csv (1)
-
irb
/ context (1) -
json
/ add / exception (1) - logger (1)
- mkmf (4)
-
net
/ ftp (1) -
net
/ http (4) - openssl (1)
- optparse (1)
- pathname (11)
- pstore (1)
- rake (6)
-
rake
/ packagetask (1) -
rexml
/ document (3) -
rubygems
/ commands / lock _ command (1) -
rubygems
/ commands / unpack _ command (1) -
rubygems
/ config _ file (1) -
rubygems
/ format (1) -
rubygems
/ gem _ path _ searcher (2) -
rubygems
/ old _ format (1) -
rubygems
/ remote _ fetcher (3) -
rubygems
/ source _ info _ cache (1) -
rubygems
/ specification (4) -
rubygems
/ validator (1) - shell (3)
-
shell
/ command-processor (3) -
shell
/ filter (2) - socket (2)
- tempfile (1)
- uri (3)
-
webrick
/ httprequest (2) - win32ole (1)
- zlib (1)
クラス
-
ARGF
. class (2) - Addrinfo (1)
-
CGI
:: Cookie (1) - CSV (1)
- Dir (2)
- Exception (2)
- File (2)
-
Gem
:: Commands :: LockCommand (1) -
Gem
:: Commands :: UnpackCommand (1) -
Gem
:: ConfigFile (1) -
Gem
:: Format (1) -
Gem
:: GemPathSearcher (2) -
Gem
:: OldFormat (1) -
Gem
:: RemoteFetcher (3) -
Gem
:: SourceInfoCache (1) -
Gem
:: Specification (4) -
Gem
:: Validator (1) -
IRB
:: Context (1) - LoadError (1)
- Logger (1)
-
Net
:: FTP :: MLSxEntry (1) -
Net
:: HTTP (1) -
Net
:: HTTPGenericRequest (1) -
Net
:: HTTPResponse (2) -
OpenSSL
:: SSL :: SSLContext (1) - OptionParser (1)
- PStore (1)
- Pathname (11)
- Proc (1)
-
RDoc
:: Options (1) -
REXML
:: Attribute (1) -
REXML
:: Element (2) -
Rake
:: Application (1) -
Rake
:: FileList (1) -
Rake
:: PackageTask (1) -
RubyVM
:: InstructionSequence (3) - Shell (3)
-
Shell
:: CommandProcessor (3) -
Shell
:: Filter (2) - String (4)
- Tempfile (1)
-
Thread
:: Backtrace :: Location (4) - TracePoint (2)
- UNIXSocket (1)
-
URI
:: Generic (2) -
URI
:: HTTP (1) -
WEBrick
:: Cookie (2) -
WEBrick
:: HTTPRequest (2) -
WIN32OLE
_ TYPELIB (1) -
Zlib
:: GzipFile (1)
モジュール
-
CGI
:: QueryExtension (2) - Kernel (4)
キーワード
-
absolute
_ path (2) - binread (1)
- binwrite (1)
-
ca
_ path (2) -
dir
_ config (1) - extname (1)
-
fetch
_ path (1) - filename (1)
-
find
_ executable (1) - formatter (1)
- ftype (1)
-
full
_ gem _ path (1) -
gem
_ path (2) -
get
_ file _ uri _ path (1) -
get
_ path (1) - inspect (3)
-
installation
_ path (1) -
irb
_ path (1) -
lib
_ dirs _ for (1) - libpathflag (1)
-
link
_ command (1) -
matching
_ files (1) -
open
_ uri _ or _ path (1) -
original
_ dir (1) -
package
_ dir _ path (1) - path= (1)
-
path
_ info (2) -
path
_ translated (1) - pathmap (2)
-
pathmap
_ explode (1) -
pathmap
_ partial (1) -
pathmap
_ replace (1) - pathname (1)
-
program
_ name (1) - read (1)
-
read
_ body (2) - readlines (1)
- readlink (3)
-
remove
_ leading _ dot _ dir (1) -
request
_ uri (1) -
require
_ path (1) -
require
_ paths (1) - select (1)
-
set
_ backtrace (1) -
source
_ location (1) -
spec
_ path (1) - split (3)
-
static
_ path (1) - sub (2)
- text (1)
-
to
_ json (1) -
to
_ path (3) -
to
_ s (2) -
try
_ file (1) -
unix
_ path (1) - write (1)
- xpath (2)
検索結果
先頭5件
-
String
# pathmap(spec = nil) { . . . } -> String (81643.0) -
与えられた書式指定文字列に応じてパス(自身)を変換します。
与えられた書式指定文字列に応じてパス(自身)を変換します。
与えられた書式指定文字列は変換の詳細を制御します。
指定できる書式指定文字列は以下の通りです。
: %p
完全なパスを表します。
: %f
拡張子付きのファイル名を表します。ディレクトリ名は含まれません。
: %n
拡張子なしのファイル名を表します。
: %d
パスに含まれるディレクトリのリストを表します。
: %x
パスに含まれるファイルの拡張子を表します。拡張子が無い場合は空文字列を表します。
: %X
拡張子以外すべてを表します。
: %s
定義されていれば、代替のファイルセパレータを表します。... -
String
# pathmap _ partial(n) -> String (81607.0) -
自身から与えられた階層分パスを抜粋します。
自身から与えられた階層分パスを抜粋します。
与えられた数値が正である場合は左から、負である場合は右から抜粋します。 -
String
# pathmap _ replace(patterns) { . . . } -> String (81607.0) -
与えられたパスを前もって置き換えます。
与えられたパスを前もって置き換えます。
@param patterns 'pat1,rep1;pat2,rep2;...' のような形式で置換パターンを指定します。 -
String
# pathmap _ explode -> Array (81370.0) -
自身をパスを表す部分ごとに分解して配列にして返します。 String#pathmap で利用される protected メソッドです。
自身をパスを表す部分ごとに分解して配列にして返します。
String#pathmap で利用される protected メソッドです。
@see String#pathmap -
URI
:: Generic # path -> String | nil (54748.0) -
自身の path を文字列で返します。設定されていない場合は nil を返します。
自身の path を文字列で返します。設定されていない場合は nil を返します。
require 'uri'
p URI.parse('http://example.com/hoge').path #=> "/hoge"
p URI.parse('http://example.com').path #=> ""
p URI.parse('mailto:nospam@localhost').path #=> nil
p URI('ftp://example.com/foo').path #=> 'foo'
p UR... -
CSV
# path -> String (54676.0) -
IO#path に委譲します。
IO#path に委譲します。
@see IO#path -
Net
:: HTTPGenericRequest # path -> String (54676.0) -
リクエストする path を文字列で返します。
リクエストする path を文字列で返します。
//emlist[例][ruby]{
require 'net/http'
uri = URI.parse('http://www.example.com/index.html')
req = Net::HTTP::Get.new(uri.request_uri)
req.path # => "/index.html"
//} -
File
# path -> String (54670.0) -
オープン時に使用したパスを文字列で返します。
オープン時に使用したパスを文字列で返します。
パスは self に対応するファイルを指しているとは限りません。
たとえば、ファイルが移動されていたり、削除されていたりする場合です。
@raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f... -
RubyVM
:: InstructionSequence # path -> String (54664.0) -
self が表す命令シーケンスの相対パスを返します。
self が表す命令シーケンスの相対パスを返します。
self の作成時に指定した文字列を返します。self を文字列から作成していた
場合は "<compiled>" を返します。
例1:irb で実行した場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"
例2: RubyVM::InstructionSequence.compi... -
Zlib
:: GzipFile # path -> String (54658.0) -
関連付けられている IO オブジェクトのパスを返します。 このメソッドは IO オブジェクトが path というメソッドを持つ場合のみ定義されます。
関連付けられている IO オブジェクトのパスを返します。
このメソッドは IO オブジェクトが path というメソッドを持つ場合のみ定義されます。 -
Dir
# path -> String (54652.0) -
オープンしているディレクトリのパス名を文字列で返します。
オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//} -
Tempfile
# path -> String | nil (54646.0) -
テンポラリファイルのパス名を返します。
テンポラリファイルのパス名を返します。
Tempfile#close! を実行後だった場合にはnilを返します。
require "tempfile"
tf = Tempfile.new("hoo")
p tf.path # => "/tmp/hoo.10596.0"
tf.close!
p tf.path # => nil -
Thread
:: Backtrace :: Location # path -> String (54646.0) -
self が表すフレームのファイル名を返します。
self が表すフレームのファイル名を返します。
例: Thread::Backtrace::Location の例1を用いた例
//emlist[][ruby]{
loc = c(0..1).first
loc.path # => "caller_locations.rb"
//}
@see Thread::Backtrace::Location#absolute_path -
TracePoint
# path -> String (54646.0) -
イベントが発生したファイルのパスを返します。
イベントが発生したファイルのパスを返します。
@raise RuntimeError イベントフックの外側で実行した場合に発生します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.path # => "/path/to/test.rb"
end
trace.enable
foo 1
//} -
LoadError
# path -> String | nil (54628.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 を返します。 -
UNIXSocket
# path -> String (54628.0) -
UNIX ソケットのパスを返します。
UNIX ソケットのパスを返します。
クライアント側はパスを持たないため空文字列となります。
例:
require 'socket'
UNIXServer.open("/tmp/s") {|serv|
p serv.path #=> "/tmp/s"
} -
WIN32OLE
_ TYPELIB # path -> String (54628.0) -
TypeLibのパス名を取得します。
TypeLibのパス名を取得します。
@return TypeLibのパス名を文字列で返します。この値はレジストリの登録値を
そのまま利用するため、Rubyのパス名形式(ディレクトリ区切りは
「/」)ではなく、Windowsのパス名形式(ディレクトリ区切りは「\」)
です。
@raise WIN32OLERuntimeError TypeLibの属性が読み取れない場合に通知します。
tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
puts tli... -
WEBrick
:: Cookie # path -> String (54613.0) -
パス名を文字列で表すアクセサです。
パス名を文字列で表すアクセサです。
@param value パス名を文字列で指定します。 -
CGI
:: Cookie # path -> String (54610.0) -
クッキーを適用するパスを返します。
クッキーを適用するパスを返します。 -
Gem
:: ConfigFile # path -> String (54610.0) -
Gem を探索するパスを返します。
Gem を探索するパスを返します。 -
PStore
# path -> String (54610.0) -
データベースのファイル名を得ます。
データベースのファイル名を得ます。 -
WEBrick
:: HTTPRequest # path -> String (54610.0) -
リクエスト URI のパスを表す文字列を返します。
リクエスト URI のパスを表す文字列を返します。 -
ARGF
. class # path -> String (45613.0) -
現在開いている処理対象のファイル名を返します。
現在開いている処理対象のファイル名を返します。
標準入力に対しては - を返します。
組み込み変数 $FILENAME と同じです。
$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark
$ ruby argf.rb foo bar glark
ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark" -
Pathname
# to _ path -> String (27610.0) -
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ クトにおいては、 to_s と同じです。
File.open などの引数に渡す際に呼ばれるメソッドです。 Pathname オブジェ
クトにおいては、 to_s と同じです。
@see Pathname#to_s -
Kernel
# libpathflag(libpath = $ DEFLIBPATH| $ LIBPATH) -> String (19507.0) -
与えられた libpath を -L 付きの文字列に変換して返します。
与えられた libpath を -L 付きの文字列に変換して返します。
@param libpath LIBPATH に指定する値を指定します。 -
Shell
# expand _ path(path) -> String (18949.0) -
Fileクラスにある同名のクラスメソッドと同じです.
Fileクラスにある同名のクラスメソッドと同じです.
@param path ファイル名を表す文字列を指定します。
@see File.expand_path -
Shell
:: CommandProcessor # expand _ path(path) -> String (18949.0) -
Fileクラスにある同名のクラスメソッドと同じです.
Fileクラスにある同名のクラスメソッドと同じです.
@param path ファイル名を表す文字列を指定します。
@see File.expand_path -
Thread
:: Backtrace :: Location # absolute _ path -> String (18700.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... -
Addrinfo
# unix _ path -> String (18676.0) -
Unix domain socket の path を文字列で返します。
Unix domain socket の path を文字列で返します。
require 'socket'
Addrinfo.unix("/tmp/sock").unix_path #=> "/tmp/sock"
@raise SocketError アドレスが Unix domain socket のものでない場合に発生します -
File
# to _ path -> String (18670.0) -
オープン時に使用したパスを文字列で返します。
オープン時に使用したパスを文字列で返します。
パスは self に対応するファイルを指しているとは限りません。
たとえば、ファイルが移動されていたり、削除されていたりする場合です。
@raise IOError TMPFILE File::Constants::TMPFILEオプション付きで作成されている場合に発生します。
//emlist[例][ruby]{
File.open("testfile") {|f| f.path } #=> "testfile"
File.open("/tmp/../tmp/xxx", "w") {|f| f... -
RubyVM
:: InstructionSequence # absolute _ path -> String | nil (18664.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.... -
CGI
:: QueryExtension # path _ info -> String (18658.0) -
ENV['PATH_INFO'] を返します。
ENV['PATH_INFO'] を返します。 -
CGI
:: QueryExtension # path _ translated -> String (18658.0) -
ENV['PATH_TRANSLATED'] を返します。
ENV['PATH_TRANSLATED'] を返します。 -
WEBrick
:: HTTPRequest # path _ info -> String (18658.0) -
リクエスト URI のパスを文字列で返します。デフォルトは path と同じです。
リクエスト URI のパスを文字列で返します。デフォルトは path と同じです。 -
Dir
# to _ path -> String (18652.0) -
オープンしているディレクトリのパス名を文字列で返します。
オープンしているディレクトリのパス名を文字列で返します。
//emlist[例][ruby]{
Dir.open("..") do |d|
d.path # => ".."
d.to_path # => ".."
end
//} -
Net
:: HTTP # ca _ path -> String | nil (18646.0) -
信頼する CA 証明書ファイルが存在するディレクトリを設定します。
信頼する CA 証明書ファイルが存在するディレクトリを設定します。
@see Net::HTTP#ca_path=, OpenSSL::SSL::SSLContext#ca_path -
OpenSSL
:: SSL :: SSLContext # ca _ path -> String | nil (18628.0) -
信頼している CA 証明書ファイルを含むディレクトリを返します。
信頼している CA 証明書ファイルを含むディレクトリを返します。
設定されていない場合は nil を返します。
@see OpenSSL::SSL::SSLContext#ca_path= -
Rake
:: PackageTask # package _ dir _ path -> String (18628.0) -
パッケージに含むファイルを配置するディレクトリを返します。
パッケージに含むファイルを配置するディレクトリを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
require 'rake/packagetask'
Rake::PackageTask.new("sample", "1.0.0") do |package_task|
package_task.package_dir_path # => "pkg/sample-1.0.0"
end
//} -
Gem
:: Commands :: LockCommand # spec _ path(gem _ full _ name) -> String (18610.0) -
指定された Gem パッケージの gemspec ファイルのフルパスを返します。
指定された Gem パッケージの gemspec ファイルのフルパスを返します。
@param gem_full_name Gem パッケージの名前を指定します。 -
Gem
:: Commands :: UnpackCommand # get _ path(gemname , version _ req) -> String | nil (18610.0) -
引数で指定された条件にマッチする Gem パッケージを保存しているパスを返します。
引数で指定された条件にマッチする Gem パッケージを保存しているパスを返します。
@param gemname Gem パッケージの名前を指定します。
@param version_req バージョンの満たすべき条件を文字列で指定します。 -
Gem
:: Format # gem _ path -> String (18610.0) -
Gem のパスを返します。
Gem のパスを返します。 -
Gem
:: OldFormat # gem _ path -> String (18610.0) -
Gem のパスを返します。
Gem のパスを返します。 -
Gem
:: RemoteFetcher # fetch _ path(uri , mtime = nil , head = false) -> String | Hash (18610.0) -
与えられた URI からダウンロードしたデータを文字列として返します。
与えられた URI からダウンロードしたデータを文字列として返します。
ヘッダ情報のみ取得した場合はハッシュを返します。
@param uri データ取得先の URI を指定します。
@param mtime 更新時刻を指定します。
@param head 真を指定するとヘッダ情報のみ取得します。 -
Gem
:: RemoteFetcher # get _ file _ uri _ path(uri) -> String (18610.0) -
与えられた URI から "file://" を取り除いた文字列を返します。
与えられた URI から "file://" を取り除いた文字列を返します。
@param uri URI を表す文字列を指定します。 -
Gem
:: Specification # full _ gem _ path -> String (18610.0) -
この Gem パッケージへのフルパスを返します。
この Gem パッケージへのフルパスを返します。 -
Gem
:: Specification # installation _ path -> String (18610.0) -
この Gem パッケージのインストール先のパスを返します。
この Gem パッケージのインストール先のパスを返します。 -
Gem
:: Specification # require _ path -> String (18610.0) -
Gem::Specification#require_paths の単数バージョンです。
Gem::Specification#require_paths の単数バージョンです。
@see Gem::Specification#require_paths -
IRB
:: Context # irb _ path -> String (18610.0) -
ライブラリ内部で使用します。
ライブラリ内部で使用します。 -
RDoc
:: Options # static _ path -> [String] (18610.0) -
コマンドライン引数の --copy-files オプションで指定したパスの一覧を返し ます。
コマンドライン引数の --copy-files オプションで指定したパスの一覧を返し
ます。 -
Gem
:: RemoteFetcher # open _ uri _ or _ path(uri , last _ modified = nil , head = false , depth = 0) -> StringIO | File (18607.0) -
@param uri URI を指定します。
@param uri URI を指定します。
@param last_modified 最終更新時刻を指定します。
@param head 真を指定するとヘッダ情報のみ取得します。
@param depth 現在のリダイレクト回数を指定します。
@raise Gem::RemoteFetcher::FetchError デフォルトでは 11 回リダイレクトした場合に発生します。
depth を指定すると 10 - depth 回より多くリダイレクトした場合にこの例外が発生するようになります。
また HTTP のレスポンスが想定外のものの場合にも発生します。... -
Gem
:: Specification # require _ paths -> [String] (18607.0) -
この Gem パッケージを使用した際に require するファイルが置かれているディレクトリ のリストを返します。
この Gem パッケージを使用した際に require するファイルが置かれているディレクトリ
のリストを返します。 -
Net
:: FTP :: MLSxEntry # pathname -> String (18607.0) -
パス名を返します。
パス名を返します。 -
REXML
:: Attribute # xpath -> String (18607.0) -
その属性を指定する xpath 文字列を返します。
その属性を指定する xpath 文字列を返します。
例えば "/foo/bar/@ns:r" という文字列を返します。 -
REXML
:: Element # xpath -> String (18607.0) -
文書上の対象の要素にのみマッチする xpath 文字列を返します。
文書上の対象の要素にのみマッチする xpath 文字列を返します。
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/><c/></a>')
c = doc.root.elements[2] # <a> .. </a> の中の <c/> 要素
c # => <c/>
c.xpath # => "/a/c"
doc = REXML::Document.new('<a><b/><b/></a>')
b = doc.root.elements[2] # <a> .. </a> の中の2番目の <b... -
Rake
:: FileList # pathmap(spec = nil) -> Rake :: FileList (18370.0) -
各要素に String#pathmap を適用した新しい Rake::FileList を返します。
各要素に String#pathmap を適用した新しい Rake::FileList を返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb", "test3.rb")
file_list.pathmap("%n") # => ["test1", "test2", "test3"]
end
//}
@see String#pathmap -
WEBrick
:: Cookie # path=(value) (18313.0) -
パス名を文字列で表すアクセサです。
パス名を文字列で表すアクセサです。
@param value パス名を文字列で指定します。 -
Gem
:: GemPathSearcher # matching _ files(spec , path) -> [String] (9724.0) -
与えられた spec に path が含まれている場合、その path のリストを返します。
与えられた spec に path が含まれている場合、その path のリストを返します。
@param spec Gem::Specification のインスタンスを指定します。
@param path 探索対象のパスを指定します。 -
Pathname
# sub(pattern) {|matched| . . . } -> Pathname (9358.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内
容とする新しい Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@se... -
Pathname
# sub(pattern , replace) -> Pathname (9358.0) -
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内 容とする新しい Pathname オブジェクトを生成し、返します。
self を表現するパス文字列に対して sub メソッドを呼び出し、その結果を内
容とする新しい Pathname オブジェクトを生成し、返します。
@param pattern 置き換える文字列のパターンを指定します。
@param replace pattern で指定した文字列と置き換える文字列を指定します。
//emlist[例][ruby]{
require 'pathname'
path1 = Pathname('/usr/bin/perl')
path1.sub('perl', 'ruby') #=> #<Pathname:/usr/bin/ruby>
//}
@se... -
Pathname
# to _ s -> String (9343.0) -
パス名を文字列で返します。
パス名を文字列で返します。
//emlist[例][ruby]{
require 'pathname'
path = Pathname.new("/tmp/hogehoge")
File.open(path)
//} -
Pathname
# write(string , offset=nil , **opts) -> Integer (9325.0) -
IO.write(self.to_s, string, offset, **opts)と同じです。
@see IO.write -
Gem
:: GemPathSearcher # lib _ dirs _ for(spec) -> String (9307.0) -
ライブラリの格納されているディレクトリを glob に使える形式で返します。
ライブラリの格納されているディレクトリを glob に使える形式で返します。
例:
'/usr/local/lib/ruby/gems/1.8/gems/foobar-1.0/{lib,ext}' -
Pathname
# binread(*args) -> String | nil (9307.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 (9307.0) -
IO.binwrite(self.to_s, *args)と同じです。
IO.binwrite(self.to_s, *args)と同じです。
@see IO.binwrite -
Pathname
# extname -> String (9307.0) -
File.extname(self.to_s) と同じです。
File.extname(self.to_s) と同じです。
@see File.extname -
Pathname
# ftype -> String (9307.0) -
File.ftype(self.to_s) と同じです。
File.ftype(self.to_s) と同じです。
@see File.ftype -
Pathname
# read(*args) -> String | nil (9307.0) -
IO.read(self.to_s, *args)と同じです。
IO.read(self.to_s, *args)と同じです。
@see IO.read -
Pathname
# readlines(*args) -> [String] (9307.0) -
IO.readlines(self.to_s, *args)と同じです。
IO.readlines(self.to_s, *args)と同じです。
@see IO.readlines -
Kernel
# link _ command(ldflags , opt = "" , libpath = $ DEFLIBPATH| $ LIBPATH) -> String (1207.0) -
実際にリンクする際に使用するコマンドを返します。
実際にリンクする際に使用するコマンドを返します。
@param ldflags LDFLAGS に追加する値を指定します。
@param opt LIBS に追加する値を指定します。
@param libpath LIBPATH に指定する値を指定します。
@see RbConfig.expand -
Kernel
# find _ executable(bin , path = nil) -> String | nil (712.0) -
パス path から実行ファイル bin を探します。
パス path から実行ファイル bin を探します。
実行ファイルが見つかった場合は、そのフルパスを返します。
実行ファイルが見つからなかった場合は、nilを返します。
このメソッドは Makefile を変更しません。
@param bin 実行ファイルの名前を指定します。
@param path パスを指定します。デフォルトは環境変数 PATH です。
環境変数 PATH が定義されていない場合は /usr/local/bin,
/usr/ucb, /usr/bin, /bin を使います。 -
Kernel
# dir _ config(target , idefault = nil , ldefault = nil) -> [String , String] (700.0) -
configure オプション --with-TARGET-dir, --with-TARGET-include, --with-TARGET-lib をユーザが extconf.rb に指定できるようにします。
configure オプション
--with-TARGET-dir,
--with-TARGET-include,
--with-TARGET-lib
をユーザが extconf.rb に指定できるようにします。
--with-TARGET-dir オプションは
システム標準ではない、
ヘッダファイルやライブラリがあるディレクトリをまとめて指定するために使います。
ユーザが extconf.rb に --with-TARGET-dir=PATH を指定したときは
$CFLAGS に "-IPATH/include" を、
$LDFLAGS に "-LPATH/lib" を、
それぞれ追加し... -
Exception
# set _ backtrace(errinfo) -> nil | String | [String] (682.0) -
バックトレース情報に errinfo を設定し、設定されたバックトレース 情報を返します。
バックトレース情報に errinfo を設定し、設定されたバックトレース
情報を返します。
@param errinfo nil、String あるいは String の配列のいずれかを指定します。
//emlist[例][ruby]{
begin
begin
raise "inner"
rescue
raise "outer"
end
rescue
$!.backtrace # => ["/path/to/test.rb:5:in `rescue in <main>'", "/path/to/test.rb:2:in `<main>'"]
$!.se... -
REXML
:: Element # text(path = nil) -> String | nil (646.0) -
先頭のテキスト子ノードの文字列を返します。
先頭のテキスト子ノードの文字列を返します。
テキストノードを複数保持している場合は最初のノードにしか
アクセスできないことに注意してください。
raw モードの設定は無視され、常に正規化されたテキストを返します。
REXML::Text#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#get_text
//emlist[][ruby]{
require 'rexml... -
Gem
:: SourceInfoCache # try _ file(path) -> String | nil (628.0) -
与えられたパスがキャッシュファイルとして利用可能な場合、そのパスを返します。 そうでない場合は nil を返します。
与えられたパスがキャッシュファイルとして利用可能な場合、そのパスを返します。
そうでない場合は nil を返します。
@param path キャッシュファイルの候補となるパスを指定します。 -
Shell
# readlink(path) -> String (628.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path シンボリックリンクを表す文字列を指定します。
@see File.readlink -
Shell
:: CommandProcessor # readlink(path) -> String (628.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path シンボリックリンクを表す文字列を指定します。
@see File.readlink -
Shell
:: Filter # readlink(path) -> String (628.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param path シンボリックリンクを表す文字列を指定します。
@see File.readlink -
Gem
:: Validator # remove _ leading _ dot _ dir(path) -> String (610.0) -
与えられたパスの先頭のドットを取り除いた文字列を返します。
与えられたパスの先頭のドットを取り除いた文字列を返します。 -
Shell
# split(pathname) -> [String] (607.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split -
Shell
:: CommandProcessor # split(pathname) -> [String] (607.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split -
Shell
:: Filter # split(pathname) -> [String] (607.0) -
File クラスにある同名のクラスメソッドと同じです.
File クラスにある同名のクラスメソッドと同じです.
@param pathname パス名を表す文字列を指定します。
@see File.split -
URI
:: HTTP # request _ uri -> String (439.0) -
自身の「path + '?' + query」を文字列で返します。 query が nil である場合は、自身の path を返します。
自身の「path + '?' + query」を文字列で返します。
query が nil である場合は、自身の path を返します。
path が空である場合には、path は「'/'」であるとします。
例:
require 'uri'
u = URI.parse("http://example.com/search?q=xxx")
p u.request_uri #=> "/search?q=xxx" -
Net
:: HTTPResponse # read _ body(dest=nil) -> String|nil (361.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
ブロックを与えなかった場合にはエンティティボディを
文字列で返します。
ブロックを与えた場合には
エンティティボディを少しずつ取得して順次ブロックに
文字列で与えます。
レスポンスがボディを持たない場合には nil を返します。
//emlist[例1 ブロックを与えずに一度に結果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<... -
Proc
# source _ location -> [String , Integer] | nil (361.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 # => ... -
Thread
:: Backtrace :: Location # inspect -> String (361.0) -
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文 字列に変換したオブジェクトを返します。
Thread::Backtrace::Location#to_s の結果を人間が読みやすいような文
字列に変換したオブジェクトを返します。
//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.inspect
end
# => "path/to/foo.rb:5:in ... -
Thread
:: Backtrace :: Location # to _ s -> String (361.0) -
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し ます。
self が表すフレームを Kernel.#caller と同じ表現にした文字列を返し
ます。
//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.to_s
end
# => path/to/foo.rb:5:in `initialize'
# path/to/foo... -
Exception
# to _ json(*args) -> String (343.0) -
自身を JSON 形式の文字列に変換して返します。
自身を JSON 形式の文字列に変換して返します。
内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。
@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。
//emlist[例][ruby]{
require "json/add/core"
begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivis... -
Logger
# formatter -> String (325.0) -
ログを出力する際に使用するフォーマッターを取得します。
ログを出力する際に使用するフォーマッターを取得します。
このメソッドの返り値が持つ call メソッドは 4 つの引数 (severity, time, program name, message) を受けとります。
//emlist[例][ruby]{
require 'logger'
logger = Logger.new(STDOUT)
logger.formatter # => nil
logger.info("test")
# => I, [2019-05-09T22:13:56.509159 #13912] INFO -- : test
ltsv_formatter =... -
OptionParser
# program _ name -> String (325.0) -
プログラムの名前を文字列で返します。
プログラムの名前を文字列で返します。
デフォルトは $0 が使われます。
@return プログラムの名前を文字列で返します。
//emlist[例][ruby]{
require "optparse"
OptionParser.new do |opts|
p $0 # => /path/to/filename.rb
p opts.program_name # => filename
end
//} -
Rake
:: Application # original _ dir -> String (325.0) -
rake コマンドを実行したディレクトリを返します。
rake コマンドを実行したディレクトリを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: :test_rake_app
task :test_rake_app do
Rake.application.original_dir # => "/path/to/dir"
end
//} -
RubyVM
:: InstructionSequence # inspect -> String (325.0) -
self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。
self の情報をラベルとパスを含んだ人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
iseq.inspect # => "<RubyVM::InstructionSequence:<compiled>@<compiled>>"
//}
@see RubyVM::InstructionSequence#label,
RubyVM::InstructionSequence#path -
TracePoint
# inspect -> String (325.0) -
self の状態を人間に読みやすい文字列にして返します。
self の状態を人間に読みやすい文字列にして返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.inspect # "#<TracePoint:call `foo'@/path/to/test.rb:1>"
end
trace.enable
foo 1
//} -
URI
:: Generic # select(*components) -> [String] (325.0) -
指定された components に対応する構成要素を文字列の配列として返します。
指定された components に対応する構成要素を文字列の配列として返します。
@param components 構成要素名をシンボルで指定します。
例:
require 'uri'
uri = URI.parse('http://myuser:mypass@my.example.com/test.rbx')
p uri.select(:userinfo, :host, :path)
# => ["myuser:mypass", "my.example.com", "/test.rbx"] -
ARGF
. class # filename -> String (313.0) -
現在開いている処理対象のファイル名を返します。
現在開いている処理対象のファイル名を返します。
標準入力に対しては - を返します。
組み込み変数 $FILENAME と同じです。
$ echo "foo" > foo
$ echo "bar" > bar
$ echo "glark" > glark
$ ruby argf.rb foo bar glark
ARGF.filename # => "foo"
ARGF.read(5) # => "foo\nb"
ARGF.filename # => "bar"
ARGF.skip
ARGF.filename # => "glark" -
Net
:: HTTPResponse # read _ body {|str| . . . . } -> () (61.0) -
ブロックを与えなかった場合にはエンティティボディを 文字列で返します。 ブロックを与えた場合には エンティティボディを少しずつ取得して順次ブロックに 文字列で与えます。
ブロックを与えなかった場合にはエンティティボディを
文字列で返します。
ブロックを与えた場合には
エンティティボディを少しずつ取得して順次ブロックに
文字列で与えます。
レスポンスがボディを持たない場合には nil を返します。
//emlist[例1 ブロックを与えずに一度に結果取得][ruby]{
require 'net/http'
uri = "http://www.example.com/index.html"
response = Net::HTTP.get_response(URI.parse(uri))
response.read_body[0..10] # => "<...