122件ヒット
[1-100件を表示]
(0.085秒)
別のキーワード
クラス
- CSV (36)
-
CSV
:: Table (12) -
Fiddle
:: Handle (24) -
File
:: Stat (12) - Matrix (14)
- OpenStruct (12)
- Pathname (12)
キーワード
- [] (12)
- antisymmetric? (7)
- cleanpath (12)
-
header
_ convert (36) - mode (12)
-
skew
_ symmetric? (7) - symlink? (12)
-
to
_ h (12)
検索結果
先頭5件
-
Fiddle
:: Handle # sym(func) -> Integer (15114.0) -
関数やグローバル変数 func へのポインタを取得し、整数として返します。
...@param func 得たいシンボルの名前を文字列で与えます。
@raise Fiddle::DLError シンボルが見つからなかった時に発生します。
require 'fiddle'
h = Fiddle::Handle.new('libc.so.6')
p h.sym('strlen') # 関数ポインタのアドレスを整数で表示... -
File
:: Stat # symlink? -> false (6107.0) -
シンボリックリンクである時に真を返します。 ただし、File::Statは自動的にシンボリックリンクをたどっていくので 常にfalseを返します。
...たどっていくので
常にfalseを返します。
//emlist[][ruby]{
require 'fileutils'
outfile = $0 + ".ln"
FileUtils.ln_s($0, outfile)
p File::Stat.new(outfile).symlink? #=> false
p File.lstat(outfile).symlink? #=> true
p FileTest.symlink?(outfile) #=> true
//}
@see File.lstat... -
Matrix
# antisymmetric? -> bool (6107.0) -
行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。
...uby]{
require 'matrix'
Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true
Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetri......c? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}... -
Matrix
# skew _ symmetric? -> bool (6107.0) -
行列が反対称行列 (交代行列、歪〔わい〕対称行列とも) ならば true を返します。
...uby]{
require 'matrix'
Matrix[[0, -2, Complex(1, 3)], [2, 0, 5], [-Complex(1, 3), -5, 0]].antisymmetric? # => true
Matrix.empty.antisymmetric? # => true
Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]].antisymmetric? # => false
# 対角要素が違う
Matrix[[1, -2, 3], [2, 0, 6], [-3, -6, 0]].antisymmetri......c? # => false
# 符号が違う
Matrix[[0, 2, -3], [2, 0, 6], [-3, 6, 0]].antisymmetric? # => false
//}... -
Pathname
# cleanpath(consider _ symlink = false) -> Pathname (113.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...操作
だけで処理を行います。
@param consider_symlink 真ならパス要素にシンボリックリンクがあった場合
にも問題ないように .. を残します。
//emlist[例][ruby]{
require "pathname"
path = Pathname.new("//.././../")
path......ame://.././../>
path.cleanpath # => #<Pathname:/>
require 'pathname'
Dir.rmdir("/tmp/foo") rescue nil
File.unlink("/tmp/bar/foo") 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... -
CSV
:: Table # mode -> Symbol (107.0) -
現在のアクセスモードを返します。
...現在のアクセスモードを返します。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header1", "header2"], ["row1_1", "row1_2"])
table = CSV::Table.new([row])
table.mode # => :col_or_row
table.by_col!
table.mode # => :col
//}... -
OpenStruct
# to _ h -> { Symbol => object } (107.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
...self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
//}......self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
ブロックを指定すると各ペアでブロックを呼び出し、
その結果をペアとして使います。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" =>... -
CSV
# header _ convert {|field , field _ info| . . . } (19.0) -
CSV#convert に似ていますが、ヘッダ行用のメソッドです。
...ます。
//emlist[例 name を指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}
//emlist[例 ブロックを指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,r......ow1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.headers # => [:header1, :header2]
//}
@see CSV#header_converters, CSV#convert... -
CSV
# header _ convert {|field| . . . } (19.0) -
CSV#convert に似ていますが、ヘッダ行用のメソッドです。
...ます。
//emlist[例 name を指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}
//emlist[例 ブロックを指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,r......ow1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.headers # => [:header1, :header2]
//}
@see CSV#header_converters, CSV#convert... -
CSV
# header _ convert(name) (19.0) -
CSV#convert に似ていますが、ヘッダ行用のメソッドです。
...ます。
//emlist[例 name を指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,row1_2", headers: true)
csv.header_convert(:symbol)
csv.first.headers # => [:header1, :header2]
//}
//emlist[例 ブロックを指定][ruby]{
require "csv"
csv = CSV.new("header1,header2\nrow1_1,r......ow1_2", headers: true)
csv.header_convert do |field|
field.to_sym
end
csv.first.headers # => [:header1, :header2]
//}
@see CSV#header_converters, CSV#convert...