1341件ヒット
[101-200件を表示]
(0.029秒)
ライブラリ
- ビルトイン (551)
- csv (48)
- delegate (12)
- drb (12)
-
drb
/ extserv (12) -
irb
/ xmp (12) - json (36)
-
net
/ ftp (24) -
net
/ http (24) -
net
/ pop (24) -
net
/ smtp (32) - openssl (96)
- prettyprint (24)
- prime (24)
- psych (36)
-
rdoc
/ code _ object (12) - resolv (24)
-
rinda
/ rinda (12) -
ripper
/ sexp (24) - socket (120)
- stringio (36)
- tempfile (38)
- win32ole (60)
- zlib (48)
クラス
- CSV (48)
- Class (24)
-
DRb
:: DRbObject (12) -
DRb
:: ExtServ (12) - Dir (72)
- Fiber (12)
- File (36)
- Hash (24)
- IO (312)
-
JSON
:: Parser (12) -
JSON
:: State (12) -
Net
:: FTP (24) -
Net
:: HTTP (24) -
Net
:: POP3 (24) -
Net
:: SMTP (32) - Object (24)
-
OpenSSL
:: ASN1 :: ObjectId (36) -
OpenSSL
:: X509 :: Attribute (24) -
OpenSSL
:: X509 :: Name (36) - PrettyPrint (24)
- Prime (24)
- Proc (19)
-
RDoc
:: CodeObject (12) -
Resolv
:: DNS (24) -
Rinda
:: DRbObjectTemplate (12) - Ripper (24)
- SimpleDelegator (12)
- Socket (24)
- StringIO (36)
- Tempfile (38)
- Thread (24)
- UNIXServer (48)
- UNIXSocket (48)
- WIN32OLE (24)
-
WIN32OLE
_ METHOD (12) -
WIN32OLE
_ TYPE (12) -
WIN32OLE
_ TYPELIB (12) - XMP (12)
-
Zlib
:: GzipReader (24) -
Zlib
:: GzipWriter (24)
モジュール
-
GC
:: Profiler (12) - JSON (12)
- Psych (24)
オブジェクト
- ENV (4)
キーワード
-
const
_ load (12) - create (2)
-
create
_ id (12) - dump (24)
- dup (4)
- each (24)
-
for
_ fd (12) - format (12)
- generate (12)
-
handle
_ interrupt (12) - instance (24)
-
new
_ with _ uri (12) - open (288)
-
pending
_ interrupt? (12) - pipe (96)
- popen (168)
- register (12)
- result (12)
- sexp (12)
-
sexp
_ raw (12) -
singleline
_ format (12) - start (80)
- unix (24)
-
yaml
_ tag (12) - yield (12)
検索結果
先頭5件
-
Class
. new(superclass = Object) {|klass| . . . } -> Class (18229.0) -
新しく名前の付いていない superclass のサブクラスを生成します。
...める際に代入されている定数名を検
索し、見つかった定数名をクラス名とします。
//emlist[例][ruby]{
p foo = Class.new # => #<Class:0x401b90f8>
p foo.name # => nil
Foo = foo # ここで p foo すれば "Foo" 固定
Bar = foo
p foo.name......s.new(superclass)
klass.module_eval {|m|
# ...
}
klass
//}
この場合も生成したクラスを返します。
ブロックの実行は Class#initialize が行います。
@param superclass 生成するクラスのスーパークラスを指定します。
//emlist[例][ruby]{
k = Class.new{......|c|
def initialize
p "in initialize"
end
def hoge
p "hoge hoge hoge"
end
}
o = k.new #=> "in initialize"
o.hoge #=> "hoge hoge hoge"
//}... -
OpenSSL
:: X509 :: Name . new(ary , template = OBJECT _ TYPE _ TEMPLATE) -> OpenSSL :: X509 :: Name (18217.0) -
OpenSSL::X509::Name オブジェクトを生成します。
...:
require 'openssl'
OpenSSL::X509::Name.new([["C", "JP"], ["ST", "Kanagawa"], ["L", "Yokohama"], ["O", "Example Company"], ["OU", "Lab3"], ["CN", "foobar"], ["emailAddress", "foobar@lab3.example.co.jp"]])
# => OpenSSL::X509::Name object: /C=JP/ST=Kanagawa/L=Yokohama/O=Example Company/OU=... -
UNIXServer
. new(path) {|sock| . . . } -> object (18211.0) -
path で指定したパス名を用いて接続を受け付けるソケット を作成します。
...クを呼びだし、
ブロック終了時にソケットを閉じます。この場合には
ブロックの評価値を返り値として返します。
@param path 接続を受け付けるパス名文字列
require 'socket'
serv = UNIXServer.new("/tmp/sock")
s = serv.accept
p s.read... -
UNIXSocket
. new(path) {|sock| . . . } -> object (18211.0) -
path で指定したパス名を用いてソケットを接続します。
...してそのブロックを呼びだし、
ブロック終了時にソケットを閉じます。この場合には
ブロックの評価値を返り値として返します。
@param path 接続先のパス名文字列
require 'socket'
s = UNIXSocket.new("/tmp/sock")
s.send("hello", 0)... -
SimpleDelegator
. new(obj) -> object (18209.0) -
メソッドを委譲するオブジェクトの設定と、 メソッド委譲を行うためのクラスメソッドの定義を行います。
...メソッドを委譲するオブジェクトの設定と、
メソッド委譲を行うためのクラスメソッドの定義を行います。
@param obj 委譲先のオブジェクト
@see Delegator.new... -
WIN32OLE
_ TYPELIB . new(libname , mjv = nil , miv = nil) -> WIN32OLE _ TYPELIB (18162.0) -
WIN32OLE_TYPELIBオブジェクトを生成します。
...。
tlib1 = WIN32OLE_TYPELIB.new('Microsoft Excel 14.0 Object Library')
tlib2 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}')
tlib3 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000046}', 1.7)
tlib4 = WIN32OLE_TYPELIB.new('{00020813-0000-0000-C000-000000000......PELIB.new("C:\\WINDOWS\\SYSTEM32\\SHELL32.DLL")
puts tlib1.name # => 'Microsoft Excel 14.0 Object Library'
puts tlib2.name # => 'Microsoft Excel 14.0 Object Library'
puts tlib3.name # => 'Microsoft Excel 14.0 Object Library'
puts tlib4.name # => 'Microsoft Excel 14.0 Object Libra... -
Hash
. new {|hash , key| . . . } -> Hash (18151.0) -
空の新しいハッシュを生成します。ブロックの評価結果がデフォルト値になりま す。設定したデフォルト値はHash#default_procで参照できます。
...応する値も変更されます。
h = Hash.new("foo")
p h[1] #=> "foo"
p h[1].object_id #=> 6127170
p h[1] << "bar" #=> "foobar"
p h[1] #=> "foobar"
p h[2] #=> "foobar"
p h[2].object_id #=> 6127170
p h......クトになります。
h = Hash.new {|hash, key| hash[key] = "foo"}
p h[1] #=> "foo"
p h[1].object_id #=> 6126900
p h[1] << "bar" #=> "foobar"
p h[1] #=> "foobar"
p h[2] #=> "foo"
p h[2].object_id #=> 6126840
p h......#=> {1=>"foobar", 2=>"foo"}
# 値が設定されていないときに(fetchのように)例外をあげるようにもできる
h = Hash.new {|hash, key|
raise(IndexError, "hash[#{key}] has no value")
}
h[1]
# エラー hash[1] has no value (IndexError)
//}... -
Hash
. new(ifnone = nil) -> Hash (18146.0) -
空の新しいハッシュを生成します。ifnone はキーに対 応する値が存在しない時のデフォルト値です。設定したデフォルト値はHash#defaultで参照できます。
...省略した Hash.new は {} と同じです。
デフォルト値として、毎回同一のオブジェクトifnoneを返します。
それにより、一箇所のデフォルト値の変更が他の値のデフォルト値にも影響します。
//emlist[][ruby]{
h = Hash.new([])
h[0] << 0
h[......[ruby]{
h = Hash.new([])
p h[1] #=> []
p h[1].object_id #=> 6127150
p h[1] << "bar" #=> ["bar"]
p h[1] #=> ["bar"]
p h[2] #=> ["bar"]
p h[2].object_id #=> 6127150
p h #=> {}
h = Hash.new([].freeze)
h[0]... -
Proc
. new -> Proc (18145.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...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)
が発生します。
ブロックを指定しなければ、このメ......ブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
#......umentError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト... -
Proc
. new { . . . } -> Proc (18145.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...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)
が発生します。
ブロックを指定しなければ、このメ......ブロックがないのにブロックを省略した呼び出しを行ったときに発生します。
//emlist[例][ruby]{
def foo
pr = Proc.new
pr.call(1)
end
foo {|arg| p arg }
# => 1
//}
これは以下と同じです。
//emlist[例][ruby]{
def foo
yield(1)
end
foo {|arg| p arg }
#......umentError が発生します。
//emlist[例][ruby]{
def foo
Proc.new
end
foo
# => -:2:in `new': tried to create Proc object without a block (ArgumentError)
# from -:2:in `foo'
# from -:4:in `<main>'
//}
Proc.new は、Proc#initialize が定義されていれば
オブジェクト...