ライブラリ
- ビルトイン (71)
- mkmf (44)
-
net
/ http (132) -
net
/ pop (11) -
shell
/ process-controller (6)
クラス
- Module (30)
-
Net
:: HTTP (132) -
Net
:: POP3 (11) - Refinement (3)
-
Shell
:: ProcessController (6)
モジュール
- Kernel (71)
オブジェクト
- main (11)
キーワード
- Ruby用語集 (11)
-
USING
_ AT _ EXIT _ WHEN _ PROCESS _ EXIT (6) -
auth
_ only (11) - bigdecimal (11)
-
check
_ signedness (22) -
convertible
_ int (22) - get (22)
- get2 (22)
-
import
_ methods (3) - lambda (13)
- post (22)
- post2 (22)
- proc (14)
- refine (11)
-
request
_ get (22) -
request
_ post (22) -
rubygems
/ security (11) - shell (6)
-
used
_ modules (8)
検索結果
先頭5件
-
Module
# using(module) -> self (21207.0) -
引数で指定したモジュールで定義された拡張を現在のクラス、モジュールで有 効にします。
...ルで有
効にします。
有効にした拡張の有効範囲については以下を参照してください。
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html#label-Scope
@param module 有効にするモジュールを指定します。
@see Module#refine, main.using... -
main
. using(module) -> self (18213.0) -
引数で指定したモジュールで定義された拡張を有効にします。
...https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html#label-Scope
@param module 有効にするモジュールを指定します。
//emlist[例][ruby]{
module Sloth
refine String do
def downcase
self
end
end
end
"ABC".downcase # => "abc"
using Sloth
"ABC".downcas......e # => "ABC"
//}
@see Module#refine, Module#using... -
Shell
:: ProcessController :: USING _ AT _ EXIT _ WHEN _ PROCESS _ EXIT -> true (12101.0) -
@todo
@todo -
Module
. used _ modules -> [Module] (9228.0) -
現在のスコープで using されているすべてのモジュールを配列で返します。 配列内のモジュールの順番は未定義です。
...スコープで using されているすべてのモジュールを配列で返します。
配列内のモジュールの順番は未定義です。
//emlist[例][ruby]{
module A
refine Object do
end
end
module B
refine Object do
end
end
using A
using B
p Module.used_modules
#=> [B, A]
/... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) (6116.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are pas......to the
compiler using the +type+ name, in uppercase.
* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' w......ert +type+ to +Integer+ object, and vice versa.
For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:
#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#define NUM2FOOBART NUM2ULONG... -
Kernel
# convertible _ int(type , headers = nil , opts = nil) { . . . } (6116.0) -
Returns the convertible integer type of the given +type+. You may optionally specify additional +headers+ to search in for the +type+. _Convertible_ means actually same type, or typedefed from same type. If the +type+ is a integer type and _convertible_ type is found, following macros are passed as preprocessor constants to the compiler using the +type+ name, in uppercase. * 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X' is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP, where 'TYP' is the +type+ name in uppercase with replacing '_t' suffix with 'T', followed by '=X' where 'X' is the macro name to convert +type+ to +Integer+ object, and vice versa. For example, if foobar_t is defined as unsigned long, then convertible_int("foobar_t") would return "unsigned long", and define macros: #define TYPEOF_FOOBAR_T unsigned long #define FOOBART2NUM ULONG2NUM #define NUM2FOOBART NUM2ULONG
...Returns the convertible integer type of the given +type+. You may
optionally specify additional +headers+ to search in for the +type+.
_Convertible_ means actually same type, or typedefed from same type.
If the +type+ is a integer type and _convertible_ type is found,
following macros are pas......to the
compiler using the +type+ name, in uppercase.
* 'TYPEOF_', followed by the +type+ name, followed by '=X' where 'X'
is the found _convertible_ type name. * 'TYP2NUM' and 'NUM2TYP,
where 'TYP' is the +type+ name in uppercase with replacing '_t'
suffix with 'T', followed by '=X' w......ert +type+ to +Integer+ object, and vice versa.
For example, if foobar_t is defined as unsigned long, then
convertible_int("foobar_t") would return "unsigned long", and define
macros:
#define TYPEOF_FOOBAR_T unsigned long
#define FOOBART2NUM ULONG2NUM
#define NUM2FOOBART NUM2ULONG... -
Kernel
. # lambda -> Proc (6106.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...るべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定......true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロッ....../emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)... -
Kernel
. # lambda { . . . } -> Proc (6106.0) -
与えられたブロックから手続きオブジェクト (Proc のインスタンス) を生成して返します。Proc.new に近い働きをします。
...るべきです。
ブロックを指定しない lambda は Ruby 2.6 までは警告メッセージ
「warning: tried to create Proc object without a block」
が出力され、Ruby 2.7 では
ArgumentError (tried to create Proc object without a block)
が発生します。
ブロックを指定......true のときには警告メッセージ
「warning: Capturing the given block using Proc.new is deprecated; use `&block` instead」
が出力され、Ruby 3.0 では
ArgumentError (tried to create Proc object without a block)
が発生します。
@raise ArgumentError スタック上にブロッ....../emlist[例][ruby]{
def foo &block
lambda(&block)
end
it = foo{p 12}
it.call #=> 12
//}
@see Proc,Proc.new
===[a:should_use_next] 手続きを中断して値を返す
手続きオブジェクトを中断して、呼出し元(呼び出しブロックでは yield、それ以外では Proc#call)... -
Net
:: POP3 . auth _ only(address , port = nil , account , password , isapop=false) (6106.0) -
POP セッションを開き、認証だけを行って接続を切ります。
...ます。
主に POP before SMTP のために用意されています。
使用例:
require 'net/pop'
Net::POP3.auth_only('pop.example.com', nil, # using default port (110)
'YourAccount', 'YourPassword')
@param address POP3サーバのホスト名文字列
@param... -
bigdecimal (6006.0)
-
bigdecimal は浮動小数点数演算ライブラリです。 任意の精度で 10 進表現された浮動小数点数を扱えます。
...bigdecimal は浮動小数点数演算ライブラリです。
任意の精度で 10 進表現された浮動小数点数を扱えます。
//emlist[][ruby]{
require 'bigdecimal'
a = BigDecimal("0.123456789123456789")
b = BigDecimal("123456.78912345678", 40)
print a + b # => 0.123456912580245903456......cimal では正確な値を得る事ができます。
//emlist[例1: 0.0001 を 10000 回足す場合。][ruby]{
sum = 0
for i in (1..10000)
sum = sum + 0.0001
end
print sum # => 0.9999999999999062
//}
//emlist[例2: 0.0001 を 10000 回足す場合。(BigDecimal)][ruby]{
require 'bigdecimal'......//emlist[pi.rb][ruby]{
#!/usr/local/bin/ruby
require "bigdecimal"
#
# Calculates 3.1415.... (the number of times that a circle's diameter
# will fit around the circle) using J. Machin's formula.
#
def big_pi(sig) # sig: Number of significant figures
exp = -sig
pi = BigDecimal("0")
tw... -
shell (6006.0)
-
Ruby 上で sh/csh のようにコマンドの実行及びフィルタリングを手軽に行うためのライブラリです。
...プル
==== Example 1:
require 'shell'
sh = Shell.cd("/tmp")
sh.mkdir "shell-test-1" unless sh.exists?("shell-test-1")
sh.cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
unless sh.exists?(dir)
sh.mkdir dir
sh.cd(dir) do
f = sh.open("tmpFile", "w")
f.......puts "TEST"
f.close
end
print sh.pwd
end
end
==== Example 2:
require 'shell'
sh = Shell.cd("/tmp")
sh.transact do
mkdir "shell-test-1" unless exists?("shell-test-1")
cd("shell-test-1")
for dir in ["dir1", "dir3", "dir5"]
if !exists?(dir)
m......kdir dir
cd(dir) do
f = open("tmpFile", "w")
f.print "TEST\n"
f.close
end
print pwd
end
end
end
==== Example 3: Using Pipe
require 'shell'
sh = Shell.new
sh.cat("/etc/printcap") | sh.tee("tee1") > "tee2"
(sh.cat < "/etc/prin... -
Module
# refine(klass) { . . . } -> Module (3124.0) -
引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で きるモジュールを定義します。定義した機能は Module#refine を使用せずに直 接 klass に対して変更を行う場合と異なり、限られた範囲のみ有効にできます。 そのため、既存の機能を局所的に修正したい場合などに用いる事ができます。
...引数 klass で指定したクラスまたはモジュールだけに対して、ブロックで指定した機能を提供で
きるモジュールを定義します。定義した機能は Module#refine を使用せずに直
接 klass に対して変更を行う場合と異なり、限られた......* https://magazine.rubyist.net/articles/0041/0041-200Special-refinement.html
* https://docs.ruby-lang.org/en/master/syntax/refinements_rdoc.html
定義した機能は main.using, Module#using を実行した場合のみ
有効になります。
@param klass 拡張する対象のクラスまた......機能を持つ無名のモジュールを返します。
//emlist[例][ruby]{
class C
def foo
puts "C#foo"
end
end
module M
refine C do
def foo
puts "C#foo in M"
end
end
end
x = C.new
x.foo # => "C#foo"
using M
x = C.new
x.foo # => "C#foo in M"
//}
@see main.using...