るりまサーチ

最速Rubyリファレンスマニュアル検索!
288件ヒット [1-100件を表示] (0.135秒)

別のキーワード

  1. psych psych_y
  2. kernel y
  3. kernel psych_y
  4. psych y
  5. y psych

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

RubyVM::InstructionSequence#path -> String (24120.0)

self が表す命令シーケンスの相対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.path
# => "<compiled>"

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('method.rb')
> iseq.path # => "method.rb"

@see RubyVM::InstructionSequence#absolute_path...

WIN32OLE_TYPELIB#path -> String (21114.0)

TypeLibのパス名を取得します。

...TypeLibのパス名を取得します。

@return TypeLibのパス名を文字列で返します。この値はレジストリの登録値を
そのまま利用するため、Rubyのパス名形式(ディレクトリ区切りは
「/」)ではなく、Windowsのパス名形式(...
...「\」)
です。
@raise WIN32OLERuntimeError TypeLibの属性が読み取れない場合に通知します。

tlib = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
puts tlib.path # => 'C:\...\EXCEL.EXE'

TypeLibは拡張子TLB(まれにOLB)という独立したフ...

RubyVM::InstructionSequence#absolute_path -> String | nil (12120.0)

self が表す命令シーケンスの絶対パスを返します。

...= RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.absolute_path
# => nil

例2: RubyVM::InstructionSequence.compile_file を使用した場合

# /tmp/method.rb
def hello
puts "hello, world"
end

# irb
> iseq = Ruby...
...VM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.absolute_path # => "/tmp/method.rb"

@see RubyVM::InstructionSequence#path...

Pathname#cleanpath(consider_symlink = false) -> Pathname (9343.0)

余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

...な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。

cleanpath は、実際にファイルシステムを参照することなく、文字列操作
だけで処理を行います。

@param consider_symlink 真ならパス要素にシンボリックリン...
...にも問題ないように .. を残します。

//emlist[例][ruby]{
require "pathname"
path
= Pathname.new("//.././../")
path
# => #<Pathname://.././../>
path
.cleanpath # => #<Pathname:/>


require 'pathname'
Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/bar/f...
...rescue nil
Dir.rmdir("/tmp/bar") rescue nil
Dir.mkdir("/tmp/foo")
Dir.mkdir("/tmp/bar")
File.symlink("../foo", "/tmp/bar/foo")
path
= Pathname.new("bar/././//foo/../bar")
Dir.chdir("/tmp")

path
.cleanpath # => #<Pathname:bar/bar>
path
.cleanpath(true) # => #<Pathname:bar/foo/../bar>
//}...

Pathname#relative_path_from(base_directory) -> Pathname (9326.0)

base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。

...irectory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。

パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。

self が相対パスなら base_directory も相...
...対パスなら
base_directory も絶対パスでなければなりません。

@param base_directory ベースディレクトリを表す Pathname オブジェクトを指定します。

@raise ArgumentError Windows上でドライブが違うなど、base_directory から self への相対パス...
...が求められないときに例外が発生します。

//emlist[例][ruby]{
require 'pathname'

path
= Pathname.new("/tmp/foo")
base = Pathname.new("/tmp")

path
.relative_path_from(base) # => #<Pathname:foo>
//}...

絞り込み条件を変える

Pathname#each_entry {|pathname| ... } -> nil (9207.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

...self.to_s) {|f| yield Pathname.new(f) } と同じです。


//emlist[例][ruby]{
require "pathname"

Path
name("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}...
...{|f| yield Pathname.new(f) } と同じです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require "pathname"

Path
name("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname...
...:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

Pathname#empty? -> bool (9113.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'

Path
name("/usr/local").empty? # => false
Dir.mktmpdir { |dir| Pathname(dir).empty? } # => true
/...
.../}

//emlist[例 ファイルの場合][ruby]{
require "pathname"
require 'tempfile'

Path
name("testfile").empty? # => false
Tempfile.create("tmp") { |tmp| Pathname(tmp).empty? } # => true
//}

@see Dir.empty?, FileTest.#empty?, Pathname#zero?...

Pathname#each_entry -> Enumerator (9107.0)

Dir.foreach(self.to_s) {|f| yield Pathname.new(f) } と同じです。

...{|f| yield Pathname.new(f) } と同じです。

ブロックを省略した場合は Enumerator を返します。

//emlist[例][ruby]{
require "pathname"

Path
name("/usr/local").each_entry {|f| p f }

# => #<Pathname:.>
# => #<Pathname:..>
# => #<Pathname:bin>
# => #<Pathname:etc>
# => #<Pathname...
...:include>
# => #<Pathname:lib>
# => #<Pathname:opt>
//}

@see Dir.foreach...

Addrinfo#family_addrinfo(path) -> Addrinfo (6220.0)

引数から自身に「似た」Addrinfo オブジェクトを生成します。

...を意味します。

require 'socket'

Addrinfo.tcp("0.0.0.0", 4649).family_addrinfo("www.ruby-lang.org", 80)
#=> #<Addrinfo: 221.186.184.68:80 TCP (www.ruby-lang.org:80)>

Addrinfo.unix("/tmp/sock").family_addrinfo("/tmp/sock2")
#=> #<Addrinfo: /tmp/sock2 SOCK_STREAM>

@param host ホ...
...スト(IP アドレスもしくはホスト名)
@param port ポート番号(整数)もしくはサービス名(文字列)
@param path Unix domain socket のパス...

Encoding::Converter#convpath -> Array (6207.0)

変換器が行う変換の経路を配列にして返します。

...う変換の経路の配列

//emlist[][ruby]{
ec = Encoding::Converter.new("ISo-8859-1", "EUC-JP", crlf_newline: true)
p ec.convpath
#=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>],
# [#<Encoding:UTF-8>, #<Encoding:EUC-JP>],
# "crlf_newline"]
//}

@see Encoding::Converter.search_convpath...

絞り込み条件を変える

<< 1 2 3 > >>