クラス
- Array (21)
-
Digest
:: Base (84) - Dir (24)
- File (24)
- Integer (48)
-
OpenSSL
:: BN (36) - Pathname (64)
-
RubyVM
:: InstructionSequence (24) - String (24)
-
Thread
:: Backtrace :: Location (24)
モジュール
- Base64 (24)
- Digest (12)
- Kernel (12)
-
OpenURI
:: Meta (12)
キーワード
- == (24)
- Integer (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 3
. 1 . 0 (4) - NKF (12)
- [] (8)
-
base
_ label (24) -
base
_ uri (12) - basename (24)
- bigdecimal (12)
- digest (12)
- digest! (12)
- digits (24)
- encode64 (12)
- glob (32)
- hexdigest (12)
- hexdigest! (12)
- hexencode (12)
- inspect (12)
- label (24)
- new (24)
- pack (21)
- pack テンプレート文字列 (12)
- realdirpath (12)
- realpath (24)
-
relative
_ path _ from (12) -
ruby 1
. 9 feature (12) -
rubygems
/ commands / generate _ index _ command (12) -
test
/ unit (1) -
to
_ i (12) -
to
_ s (36) - unpack (12)
-
urlsafe
_ encode64 (12)
検索結果
先頭5件
-
test
/ unit (26072.0) -
ユニットテストを行うためのライブラリです。
... Test::Unit - Ruby用単体テストフレームワーク: https://test-unit.github.io/
なお、2.2.0より前のtest/unit は当時バンドルしていた minitest/unit を使って再実装し
ていましたが、上記のtest/unitと完全な互換性がある訳ではありません。
Ruby......ています。
* Rubyのテスティングフレームワークの歴史(2014年版) https://www.clear-code.com/blog/2014/11/6.html
* RubyKaigi 2015:The history of testing framework in Ruby https://www.clear-code.com/blog/2015/12/12.html
=== 使い方
Test::Unit は以下のように...... tests with N jobs at once
--no-retry Don't retry running testcase when --jobs specified
--ruby VAL Path to ruby; It'll have used at -j option
-q, --hide-skip Hide skipped tests
-b, --basedir=DIR Base... -
Digest
:: Base (21006.0) -
すべての Digest::XXX クラスの基底クラスです。
...すべての Digest::XXX クラスの基底クラスです。
例えば、MD5 値を得るには以下のようにします。
require 'digest/md5'
p Digest::MD5.hexdigest('abc') #=> '900150983cd24fb0d6963f7d28e17f72'
p Digest::MD5.file('ruby-1.8.5.tar.gz').to_s #=> '3fbb02294a......8ca33d4684055adba5ed6f'
すべての Digest::XXX クラスは以下の共通インタフェースを持ちます。... -
RubyVM
:: InstructionSequence # base _ label -> String (12219.0) -
self が表す命令シーケンスの基本ラベルを返します。
...た場合
iseq = RubyVM::InstructionSequence.compile('num = 1 + 2')
# => <RubyVM::InstructionSequence:<compiled>@<compiled>>
iseq.base_label
# => "<compiled>"
例2: RubyVM::InstructionSequence.compile_file を使用した場合
# /tmp/method.rb
def hello
puts "hello, world"
end......# irb
> iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb')
> iseq.base_label # => "<main>"
例3:
# /tmp/method2.rb
def hello
puts "hello, world"
end
RubyVM::InstructionSequence.of(method(:hello)).base_label
# => "hello"
@see RubyVM::InstructionSequence#label... -
rubygems
/ commands / generate _ index _ command (12018.0) -
ある Gem サーバに対するインデックスを作成するためのライブラリです。
...ンデックスを作成するためのライブラリです。
Usage: gem generate_index [options]
Options:
-d, --directory=DIRNAME repository base dir containing gems subdir
Common Options:
-h, --help このコマンドのヘルプを表示し......す
-q, --quiet 静かに実行します
--config-file FILE 指定された設定ファイルを使用します
--backtrace バックトレースを表示します
--debug Ruby 自体のデバッ......Generates the index files for a gem server directory
Description:
The generate_index command creates a set of indexes for serving gems
statically. The command expects a 'gems' directory under the path given to
the --directory option. When done, it will generate a set of fil... -
Pathname
# realpath(basedir = nil) -> Pathname (9312.0) -
余計な "."、".." や "/" を取り除いた新しい Pathname オブジェクトを返します。
...thname オブジェクトを返します。
また、ファイルシステムをアクセスし、実際に存在するパスを返します。
シンボリックリンクも解決されます。
self が指すパスが存在しない場合は例外 Errno::ENOENT が発生します。
@param base......emlist[例][ruby]{
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/././//foo/../bar")
Dir.chdir("/tmp")......p path.realpath
# => ruby 1.8.0 (2003-10-10) [i586-linux]
# #<Pathname:/tmp/bar>
//}
@see Pathname#realdirpath, File.realpath... -
Pathname
# realdirpath(basedir = nil) -> Pathname (9306.0) -
Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に 存在しなくてもエラーになりません。
...Pathname#realpath とほぼ同じで、最後のコンポーネントは実際に
存在しなくてもエラーになりません。
@param basedir ベースディレクトリを指定します。省略するとカレントディレクトリになります。
//emlist[例][ruby]{
require "pathna......path = Pathname("/not_exist")
path.realdirpath # => #<Pathname:/not_exist>
path.realpath # => Errno::ENOENT
# 最後ではないコンポーネント(/not_exist_1)も存在しないのでエラーになる。
path = Pathname("/not_exist_1/not_exist_2")
path.realdirpath # => Errno::ENOENT
//......}
@see Pathname#realpath... -
Pathname
# basename(suffix = "") -> Pathname (9284.0) -
Pathname.new(File.basename(self.to_s, suffix)) と同じです。
...thname.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(".c") #=> #<Pathname:"ruby">
Pathname("ruby/ruby.c").basename(".*") #=> #<Pathname:"ruby">
Pathname("ruby/ruby.exe").basename(".*") #=> #<Pathname:"ruby">
Pathname(......"ruby/y.tab.c").basename(".*") #=> #<Pathname:"y.tab">
//}
@see File.basename... -
Pathname
# relative _ path _ from(base _ directory) -> Pathname (9259.0) -
base_directory から self への相対パスを求め、その内容の新しい Pathname オブジェクトを生成して返します。
...base_directory から self への相対パスを求め、その内容の新しい Pathname
オブジェクトを生成して返します。
パス名の解決は文字列操作によって行われ、ファイルシステムをアクセス
しません。
self が相対パスなら base_directory......elf が絶対パスなら
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>
//}... -
Thread
:: Backtrace :: Location # base _ label -> String (9213.0) -
self が表すフレームの基本ラベルを返します。通常、 Thread::Backtrace::Location#label から修飾を取り除いたもので構成 されます。
...、
Thread::Backtrace::Location#label から修飾を取り除いたもので構成
されます。
//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.base_lab......el
end
# => initialize
# new
# <main>
//}
@see Thread::Backtrace::Location#label... -
Digest
:: Base # digest! -> String (9140.0) -
updateや<<によって追加した文字列に対するハッシュ値を文字列で返します。 Digest::Base#digestと違い、 メソッドの処理後、 オブジェクトの状態を初期状態(newした直後と同様の状態)に戻します。
...updateや<<によって追加した文字列に対するハッシュ値を文字列で返します。
Digest::Base#digestと違い、
メソッドの処理後、
オブジェクトの状態を初期状態(newした直後と同様の状態)に戻します。
返す文字列は、MD5では16バイ......MD5の場合
require 'digest/md5'
digest = Digest::MD5.new
digest.update("ruby")
p digest.digest! # => "X\345=\023$\356\366&_\333\227\260\216\331\252\337"
p digest.digest! # => "\324\035\214\331\217\000\262\004\351\200\t\230\354\370B~"
@see Digest::Base#digest、Digest::Base#hexdigest!...