6669件ヒット
[1-100件を表示]
(0.041秒)
クラス
- Array (96)
- BasicObject (156)
- Binding (12)
- Class (48)
- Data (51)
- Dir (84)
-
Encoding
:: Converter (240) -
Encoding
:: InvalidByteSequenceError (24) -
Encoding
:: UndefinedConversionError (12) - Enumerator (169)
-
Enumerator
:: Chain (7) -
Enumerator
:: Lazy (12) -
Enumerator
:: Yielder (30) -
Errno
:: EXXX (24) - Exception (48)
- Fiber (66)
- File (107)
-
File
:: Stat (480) - FrozenError (14)
- Hash (187)
- IO (774)
- KeyError (44)
- LocalJumpError (24)
- Method (199)
- Module (324)
- Mutex (14)
- NameError (29)
- NoMethodError (19)
- Numeric (12)
- Object (450)
-
ObjectSpace
:: WeakMap (12) - Proc (55)
- Random (120)
- Range (50)
- Regexp (96)
-
RubyVM
:: InstructionSequence (36) - SignalException (36)
- StopIteration (12)
- String (55)
- Struct (359)
- SystemCallError (48)
- SystemExit (24)
- Thread (493)
-
Thread
:: Backtrace :: Location (48) -
Thread
:: ConditionVariable (30) -
Thread
:: Mutex (70) -
Thread
:: Queue (114) -
Thread
:: SizedQueue (70) - ThreadGroup (48)
- Time (67)
- TracePoint (165)
- UnboundMethod (24)
モジュール
- Enumerable (144)
-
GC
:: Profiler (12) - Kernel (297)
- Marshal (48)
- ObjectSpace (84)
オブジェクト
- ENV (28)
キーワード
- ! (12)
- != (12)
-
$ stdin (12) - < (12)
- << (12)
- <=> (36)
- == (99)
- === (44)
- ArgumentError (12)
- BasicObject (12)
- Complex (24)
- ConditionVariable (10)
- Data (9)
- EXXX (12)
- Enumerator (12)
- Fiber (12)
- Float (12)
- Integer (12)
- Location (12)
-
MAJOR
_ VERSION (12) -
MINOR
_ VERSION (12) - Method (12)
- Proc (12)
- Queue (10)
- Range (12)
- Rational (24)
- Regexp (12)
- SizedQueue (10)
- Stat (12)
- String (12)
- Struct (12)
- Symbol (1)
- Thread (12)
- ThreadGroup (12)
- TracePoint (12)
- UnboundMethod (12)
- UndefinedConversionError (12)
- Yielder (12)
- [] (90)
- []= (36)
-
_ _ id _ _ (12) -
_ _ send _ _ (24) -
_ dump (12) - abort (24)
-
abort
_ on _ exception (12) -
abort
_ on _ exception= (24) -
absolute
_ path (12) - add (12)
-
add
_ trace _ func (12) -
alias
_ method (12) - alive? (16)
- allocate (12)
- arity (12)
- atime (12)
- backtrace (12)
-
backtrace
_ locations (36) -
base
_ label (12) - bind (12)
-
bind
_ call (12) - binding (12)
- birthtime (11)
- blksize (12)
- blockdev? (12)
- blocks (12)
- broadcast (10)
- bytes (12)
- call (24)
-
callee
_ id (12) - casefold? (12)
- chardev? (12)
- chmod (12)
-
class
_ eval (24) -
class
_ exec (12) -
class
_ variable _ set (12) - clear (22)
- clone (12)
- close (32)
- closed? (22)
- coerce (12)
- compile (24)
-
compile
_ option= (12) - convert (12)
- convpath (12)
- ctime (12)
- current (4)
- deconstruct (9)
-
deconstruct
_ keys (9) - default (24)
-
default
_ proc (12) - define (6)
-
define
_ finalizer (24) -
define
_ method (24) -
defined
_ class (12) - deq (20)
-
destination
_ encoding (12) - dev (12)
-
dev
_ major (12) -
dev
_ minor (12) - dig (10)
- directory? (12)
- display (12)
- dump (24)
- dup (4)
- each (144)
-
each
_ char (24) -
each
_ entry (24) -
each
_ line (72) -
each
_ object (48) -
each
_ pair (24) -
each
_ with _ index (24) - empty? (10)
- enclose (12)
- enclosed? (12)
- entries (7)
-
enum
_ for (24) - eof (12)
- eof? (12)
- eql? (39)
- equal? (12)
-
error
_ bytes (12) -
error
_ char (12) -
eval
_ script (7) - event (12)
- exception (12)
- executable? (12)
-
executable
_ real? (12) - exit (12)
-
exit
_ value (12) - extend (12)
- extended (12)
- fail (36)
- feed (12)
- fetch (8)
- file? (12)
- filter (14)
- finish (12)
-
for
_ fd (12) - fork (12)
- ftype (12)
- getbyte (12)
- getc (12)
- gets (36)
- gid (12)
- grpowned? (12)
-
handle
_ interrupt (12) - hash (15)
-
ignore
_ deadlock= (4) -
incomplete
_ input? (12) - initialize (12)
-
initialize
_ copy (12) - ino (12)
-
insert
_ output (12) - inspect (99)
-
instance
_ eval (24) -
instance
_ exec (12) -
instance
_ method (12) -
instance
_ of? (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) -
instruction
_ sequence (7) -
is
_ a? (12) - isatty (12)
- join (24)
- key (8)
-
keyword
_ init? (4) - kill (24)
-
kind
_ of? (12) - lambda (18)
- lambda? (12)
-
last
_ error (12) - length (22)
- lineno (24)
- lineno= (12)
- link (12)
- list (12)
-
local
_ variable _ set (12) - locked? (12)
- loop (20)
-
marshal
_ dump (24) -
marshal
_ load (12) - match (24)
- max (58)
- max= (10)
- members (27)
- merge (24)
-
method
_ id (12) -
method
_ missing (12) - methods (12)
- min (48)
- mode (12)
-
module
_ eval (24) -
module
_ exec (12) - mtime (12)
- name (24)
- name= (10)
-
new
_ seed (12) -
next
_ values (12) - nlink (12)
- now (12)
-
num
_ waiting (10) - open (96)
-
original
_ name (12) - owned? (24)
- owner (12)
- pack (18)
- parameters (19)
- pass (12)
- path (27)
-
peek
_ values (12) -
pending
_ interrupt? (12) - pipe (96)
- pipe? (12)
- pop (20)
- popen (168)
- prepend (12)
-
primitive
_ convert (48) -
primitive
_ errinfo (12) - priority (12)
- priority= (12)
- private (48)
- proc (19)
- produce (6)
- putback (24)
- raise (66)
-
raised
_ exception (12) - rand (36)
- rdev (12)
-
rdev
_ major (12) -
rdev
_ minor (12) - readable? (12)
-
readable
_ real? (12) - readchar (12)
- readline (36)
- reason (12)
- receiver (30)
- refine (12)
-
remove
_ instance _ variable (12) - reopen (36)
- replace (12)
- replacement (12)
- replacement= (12)
-
report
_ on _ exception (18) -
report
_ on _ exception= (18) -
respond
_ to? (12) -
respond
_ to _ missing? (12) - result (24)
- resume (12)
-
return
_ value (12) - rewind (12)
- run (12)
-
safe
_ level (7) -
search
_ convpath (12) - seed (12)
- seek (12)
- select (24)
- send (24)
-
set
_ trace _ func (12) - setgid? (12)
- setuid? (12)
- shift (32)
- shuffle (24)
- signal (10)
-
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - size (46)
- size? (12)
- sleep (36)
- socket? (12)
-
source
_ encoding (12) -
source
_ location (12) - start (12)
- status (24)
- sticky? (12)
- stop (12)
- stop? (12)
- store (12)
- strftime (12)
- sum (18)
-
super
_ method (11) - symlink (12)
- symlink? (12)
- sync= (12)
- synchronize (12)
- tainted? (6)
- terminate (12)
-
thread
_ variable _ get (12) -
thread
_ variable _ set (12) -
to
_ a (19) -
to
_ ary (12) -
to
_ enum (24) -
to
_ h (44) -
to
_ hash (12) -
to
_ int (12) -
to
_ path (3) -
to
_ proc (30) -
to
_ regexp (12) -
to
_ s (83) -
to
_ str (12) - trace (12)
-
trace
_ var (36) - transfer (4)
-
try
_ lock (12) - tty? (12)
- uid (12)
- unbind (12)
-
undef
_ method (12) -
undefine
_ finalizer (12) - ungetbyte (12)
- ungetc (12)
- unlock (12)
- utime (12)
- value (12)
- values (12)
-
values
_ at (24) - wakeup (12)
- wday (12)
- with (3)
-
with
_ index (24) -
with
_ object (24) - writable? (12)
-
writable
_ real? (12) - yield (24)
- zero? (12)
検索結果
先頭5件
-
Random
. new(seed = Random . new _ seed) -> Random (18232.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 (18169.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 (18134.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 (18134.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 (18131.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 (18129.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 (18129.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 (18129.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 (18128.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 (18128.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"
//}...