6043件ヒット
[1-100件を表示]
(0.247秒)
ライブラリ
- ビルトイン (6043)
クラス
- Array (87)
- BasicObject (143)
- Binding (11)
- Class (44)
- Data (34)
- Dir (77)
-
Encoding
:: Converter (220) -
Encoding
:: InvalidByteSequenceError (22) -
Encoding
:: UndefinedConversionError (11) - Enumerator (155)
-
Enumerator
:: Chain (6) -
Enumerator
:: Lazy (11) -
Enumerator
:: Yielder (27) -
Errno
:: EXXX (22) - Exception (44)
- Fiber (57)
- File (98)
-
File
:: Stat (440) - FrozenError (12)
- Hash (171)
- IO (708)
- KeyError (38)
- LocalJumpError (22)
- Method (182)
- Module (276)
- Mutex (14)
- NameError (26)
- NoMethodError (17)
- Numeric (11)
- Object (402)
-
ObjectSpace
:: WeakMap (11) - Proc (51)
- Random (110)
- Range (45)
- Regexp (88)
-
RubyVM
:: InstructionSequence (33) - SignalException (33)
- StopIteration (11)
- String (50)
- Struct (326)
- SystemCallError (44)
- SystemExit (22)
- Thread (450)
-
Thread
:: Backtrace :: Location (44) -
Thread
:: ConditionVariable (27) -
Thread
:: Mutex (63) -
Thread
:: Queue (102) -
Thread
:: SizedQueue (63) - ThreadGroup (44)
- Time (60)
- TracePoint (150)
- UnboundMethod (21)
モジュール
- Enumerable (132)
-
GC
:: Profiler (11) - Kernel (273)
- Marshal (44)
- ObjectSpace (77)
オブジェクト
- ENV (25)
キーワード
- ! (11)
- != (11)
-
$ stdin (11) - < (11)
- << (11)
- <=> (33)
- == (79)
- === (40)
- ArgumentError (11)
- BasicObject (11)
- Complex (22)
- ConditionVariable (9)
- Data (8)
- EXXX (11)
- Enumerator (11)
- Fiber (11)
- Float (11)
- Integer (11)
- Location (11)
-
MAJOR
_ VERSION (11) -
MINOR
_ VERSION (11) - Method (11)
- Proc (11)
- Queue (9)
- Range (11)
- Rational (22)
- Regexp (11)
- SizedQueue (9)
- Stat (11)
- String (11)
- Struct (11)
- Symbol (1)
- Thread (11)
- ThreadGroup (11)
- TracePoint (11)
- UnboundMethod (11)
- UndefinedConversionError (11)
- Yielder (11)
- [] (81)
- []= (33)
-
_ _ id _ _ (11) -
_ _ send _ _ (22) -
_ dump (11) - abort (22)
-
abort
_ on _ exception (11) -
abort
_ on _ exception= (22) -
absolute
_ path (11) - add (11)
-
add
_ trace _ func (11) -
alias
_ method (11) - alive? (14)
- allocate (11)
- arity (11)
- atime (11)
- backtrace (11)
-
backtrace
_ locations (33) -
base
_ label (11) - bind (11)
-
bind
_ call (10) - binding (11)
- birthtime (10)
- blksize (11)
- blockdev? (11)
- blocks (11)
- broadcast (9)
- bytes (11)
- call (22)
-
callee
_ id (11) - casefold? (11)
- chardev? (11)
- chmod (11)
-
class
_ eval (22) -
class
_ exec (11) -
class
_ variable _ set (11) - clear (20)
- clone (11)
- close (29)
- closed? (20)
- coerce (11)
- compile (22)
-
compile
_ option= (11) - convert (11)
- convpath (11)
- ctime (11)
- current (3)
- deconstruct (7)
-
deconstruct
_ keys (7) - default (22)
-
default
_ proc (11) - define (4)
-
define
_ finalizer (22) -
define
_ method (22) -
defined
_ class (11) - deq (18)
-
destination
_ encoding (11) - dev (11)
-
dev
_ major (11) -
dev
_ minor (11) - dig (9)
- directory? (11)
- display (11)
- dump (22)
- dup (3)
- each (132)
-
each
_ char (22) -
each
_ entry (22) -
each
_ line (66) -
each
_ object (44) -
each
_ pair (22) -
each
_ with _ index (22) - empty? (9)
- enclose (11)
- enclosed? (11)
- entries (6)
-
enum
_ for (22) - eof (11)
- eof? (11)
- eql? (35)
- equal? (11)
-
error
_ bytes (11) -
error
_ char (11) -
eval
_ script (6) - event (11)
- exception (11)
- executable? (11)
-
executable
_ real? (11) - exit (11)
-
exit
_ value (11) - extend (11)
- extended (11)
- fail (33)
- feed (11)
- fetch (7)
- file? (11)
- filter (12)
- finish (11)
-
for
_ fd (11) - fork (11)
- ftype (11)
- getbyte (11)
- getc (11)
- gets (33)
- gid (11)
- grpowned? (11)
-
handle
_ interrupt (11) - hash (13)
-
ignore
_ deadlock= (3) -
incomplete
_ input? (11) - initialize (11)
-
initialize
_ copy (11) - ino (11)
-
insert
_ output (11) - inspect (90)
-
instance
_ eval (22) -
instance
_ exec (11) -
instance
_ method (11) -
instance
_ of? (11) -
instance
_ variable _ defined? (11) -
instance
_ variable _ get (11) -
instance
_ variable _ set (11) -
instance
_ variables (11) -
instruction
_ sequence (6) -
is
_ a? (11) - isatty (11)
- join (22)
- key (7)
-
keyword
_ init? (3) - kill (22)
-
kind
_ of? (11) - lambda (17)
- lambda? (11)
-
last
_ error (11) - length (20)
- lineno (22)
- lineno= (11)
- link (11)
- list (11)
-
local
_ variable _ set (11) - locked? (11)
- loop (18)
-
marshal
_ dump (22) -
marshal
_ load (11) - match (22)
- max (53)
- max= (9)
- members (24)
- merge (22)
-
method
_ id (11) -
method
_ missing (11) - methods (11)
- min (44)
- mode (11)
-
module
_ eval (22) -
module
_ exec (11) - mtime (11)
- name (22)
- name= (9)
-
new
_ seed (11) -
next
_ values (11) - nlink (11)
- now (11)
-
num
_ waiting (9) - open (88)
-
original
_ name (11) - owned? (22)
- owner (11)
- pack (16)
- parameters (17)
- pass (11)
- path (24)
-
peek
_ values (11) -
pending
_ interrupt? (11) - pipe (88)
- pipe? (11)
- pop (18)
- popen (154)
- prepend (11)
-
primitive
_ convert (44) -
primitive
_ errinfo (11) - priority (11)
- priority= (11)
- private (23)
- proc (18)
- produce (5)
- putback (22)
- raise (59)
-
raised
_ exception (11) - rand (33)
- rdev (11)
-
rdev
_ major (11) -
rdev
_ minor (11) - readable? (11)
-
readable
_ real? (11) - readchar (11)
- readline (33)
- reason (11)
- receiver (27)
- refine (11)
-
remove
_ instance _ variable (11) - reopen (33)
- replace (11)
- replacement (11)
- replacement= (11)
-
report
_ on _ exception (16) -
report
_ on _ exception= (16) -
respond
_ to? (11) -
respond
_ to _ missing? (11) - result (22)
- resume (11)
-
return
_ value (11) - rewind (11)
- run (11)
-
safe
_ level (7) -
search
_ convpath (11) - seed (11)
- seek (11)
- select (22)
- send (22)
-
set
_ trace _ func (11) - setgid? (11)
- setuid? (11)
- shift (29)
- shuffle (22)
- signal (9)
-
singleton
_ class (11) -
singleton
_ method (11) -
singleton
_ method _ added (11) -
singleton
_ method _ removed (11) -
singleton
_ method _ undefined (11) -
singleton
_ methods (11) - size (42)
- size? (11)
- sleep (33)
- socket? (11)
-
source
_ encoding (11) -
source
_ location (11) - start (11)
- status (22)
- sticky? (11)
- stop (11)
- stop? (11)
- store (11)
- strftime (11)
- sum (16)
-
super
_ method (10) - symlink (11)
- symlink? (11)
- sync= (11)
- synchronize (11)
- tainted? (6)
- terminate (11)
-
thread
_ variable _ get (11) -
thread
_ variable _ set (11) -
to
_ a (17) -
to
_ ary (11) -
to
_ enum (22) -
to
_ h (38) -
to
_ hash (11) -
to
_ int (11) -
to
_ path (2) -
to
_ proc (27) -
to
_ regexp (11) -
to
_ s (75) -
to
_ str (11) - trace (11)
-
trace
_ var (33) - transfer (3)
-
try
_ lock (11) - tty? (11)
- uid (11)
- unbind (11)
-
undef
_ method (11) -
undefine
_ finalizer (11) - ungetbyte (11)
- ungetc (11)
- unlock (11)
- utime (11)
- value (11)
- values (11)
-
values
_ at (22) - wakeup (11)
- wday (11)
- with (2)
-
with
_ index (22) -
with
_ object (22) - writable? (11)
-
writable
_ real? (11) - yield (22)
- zero? (11)
検索結果
先頭5件
-
Random
. new(seed = Random . new _ seed) -> Random (26230.0) -
メルセンヌ・ツイスタに基づく擬似乱数発生装置オブジェクトを作ります。 引数が省略された場合は、Random.new_seedの値を使用します。
...。
引数が省略された場合は、Random.new_seedの値を使用します。
@param seed 擬似乱数生成器の種を整数で指定します。
//emlist[例: 種が同じなら同じ乱数列を発生できる。][ruby]{
prng = Random.new(1234)
[ prng.ra......] #=> [0.1915194503788923, 0.6221087710398319]
[ prng.rand(10), prng.rand(1000) ] #=> [4, 664]
# 同じ乱数列を発生する。
prng = Random.new(1234)
[ prng.rand, prng.rand ] #=> [0.1915194503788923, 0.6221087710398319]
[ prng.rand(10), prng.rand(1000) ] #... -
Range
. new(first , last , exclude _ end = false) -> Range (26167.0) -
first から last までの範囲オブジェクトを生成して返しま す。
...[例: 整数の範囲オブジェクトの場合][ruby]{
Range.new(1, 10) # => 1..10
Range.new(1, 10, true) # => 1...10
//}
//emlist[例: 日付オブジェクトの範囲オブジェクトの場合][ruby]{
require 'date'
Range.new(Date.today, Date.today >> 1).each {|d| puts d }
# => 2017-09-......y]{
require 'ipaddr'
Range.new(IPAddr.new("192.0.2.1"), IPAddr.new("192.0.2.3")).each {|ip| puts ip}
# => 192.0.2.1
# 192.0.2.2
# 192.0.2.3
//}
//emlist[例: 自作のオブジェクトの場合][ruby]{
MyInteger = Struct.new(:value) do
def succ
self.class.new(value + 1)
end
def <=......>(other)
value <=> other.value
end
def to_s
value.to_s
end
end
Range.new(MyInteger.new(1), MyInteger.new(3)).each {|i| puts i }
# => 1
# 2
# 3
//}... -
Proc
. new -> Proc (26132.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クを指定しない場合、Ruby 2.7 では
$VERBOSE = 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 (26132.0) -
ブロックをコンテキストとともにオブジェクト化して返します。
...クを指定しない場合、Ruby 2.7 では
$VERBOSE = 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 が定義されていれば
オブジェクト... -
Hash
. new(ifnone = nil) -> Hash (26129.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]... -
Encoding
:: Converter . new(convpath) -> Encoding :: Converter (26127.0) -
Encoding::Converter オブジェクトを作成します。
...onverter::UNDEF_REPLACE
* Encoding::Converter::UNDEF_HEX_CHARREF
* Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR
* Encoding::Converter::CRLF_NEWLINE_DECORATOR
* Encoding::Converter::CR_NEWLINE_DECORATOR
* Encoding::Converter::XML_TEXT_DECORATOR
* Encoding::Converter::XML_ATTR_CONTENT_......oding::Converter.new("UTF-16BE", "UTF-8")
# Usually, decorators such as newline conversion are inserted last.
ec = Encoding::Converter.new("UTF-16BE", "UTF-8", :universal_newline => true)
p ec.convpath #=> [[#<Encoding:UTF-16BE>, #<Encoding:UTF-8>],
# "universal_newline"]
# But, i......ersion.
ec = Encoding::Converter.new("UTF-8", "UTF-16BE", :crlf_newline => true)
p ec.convpath #=> ["crlf_newline",
# [#<Encoding:UTF-8>, #<Encoding:UTF-16BE>]]
# Conversion path can be specified directly.
ec = Encoding::Converter.new(["universal_newline", ["EUC-JP", "UTF-8"], ["UT... -
Encoding
:: Converter . new(source _ encoding , destination _ encoding) -> Encoding :: Converter (26127.0) -
Encoding::Converter オブジェクトを作成します。
...onverter::UNDEF_REPLACE
* Encoding::Converter::UNDEF_HEX_CHARREF
* Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR
* Encoding::Converter::CRLF_NEWLINE_DECORATOR
* Encoding::Converter::CR_NEWLINE_DECORATOR
* Encoding::Converter::XML_TEXT_DECORATOR
* Encoding::Converter::XML_ATTR_CONTENT_......oding::Converter.new("UTF-16BE", "UTF-8")
# Usually, decorators such as newline conversion are inserted last.
ec = Encoding::Converter.new("UTF-16BE", "UTF-8", :universal_newline => true)
p ec.convpath #=> [[#<Encoding:UTF-16BE>, #<Encoding:UTF-8>],
# "universal_newline"]
# But, i......ersion.
ec = Encoding::Converter.new("UTF-8", "UTF-16BE", :crlf_newline => true)
p ec.convpath #=> ["crlf_newline",
# [#<Encoding:UTF-8>, #<Encoding:UTF-16BE>]]
# Conversion path can be specified directly.
ec = Encoding::Converter.new(["universal_newline", ["EUC-JP", "UTF-8"], ["UT... -
Encoding
:: Converter . new(source _ encoding , destination _ encoding , options) -> Encoding :: Converter (26127.0) -
Encoding::Converter オブジェクトを作成します。
...onverter::UNDEF_REPLACE
* Encoding::Converter::UNDEF_HEX_CHARREF
* Encoding::Converter::UNIVERSAL_NEWLINE_DECORATOR
* Encoding::Converter::CRLF_NEWLINE_DECORATOR
* Encoding::Converter::CR_NEWLINE_DECORATOR
* Encoding::Converter::XML_TEXT_DECORATOR
* Encoding::Converter::XML_ATTR_CONTENT_......oding::Converter.new("UTF-16BE", "UTF-8")
# Usually, decorators such as newline conversion are inserted last.
ec = Encoding::Converter.new("UTF-16BE", "UTF-8", :universal_newline => true)
p ec.convpath #=> [[#<Encoding:UTF-16BE>, #<Encoding:UTF-8>],
# "universal_newline"]
# But, i......ersion.
ec = Encoding::Converter.new("UTF-8", "UTF-16BE", :crlf_newline => true)
p ec.convpath #=> ["crlf_newline",
# [#<Encoding:UTF-8>, #<Encoding:UTF-16BE>]]
# Conversion path can be specified directly.
ec = Encoding::Converter.new(["universal_newline", ["EUC-JP", "UTF-8"], ["UT... -
Class
. new(superclass = Object) -> Class (26126.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"
//}... -
Class
. new(superclass = Object) {|klass| . . . } -> Class (26126.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"
//}...