るりまサーチ

最速Rubyリファレンスマニュアル検索!
107件ヒット [1-100件を表示] (0.027秒)

別のキーワード

  1. _builtin argumenterror
  2. on argumenterror
  3. new argumenterror
  4. dump argumenterror
  5. parse argumenterror

検索結果

<< 1 2 > >>

Module#include(*mod) -> self (18179.0)

モジュール mod をインクルードします。

...@raise ArgumentError 継承関係が循環してしまうような include を行った場合に発生します。

//emlist[例][ruby]{
module M
end
module M2
include
M
end
module M
include
M2
end
//}

実行結果:

-:3:in `append_features': cyclic include detected (ArgumentError)...
...in `include'
from -:3


インクルードとは、指定されたモジュールの定義
(メソッド、定数) を引き継ぐことです。
インクルードは多重継承の代わりに用いられており、 mix-in とも呼びます。

//emlist[例][ruby]{
class C
include
Fi...
...leTest
include
Math
end

p C.ancestors

# => [C, Math, FileTest, Object, Kernel]
//}

モジュールの機能追加は、クラスの継承関係の間にそのモジュールが挿入
されることで実現されています。従って、メソッドの探索などは
スーパークラスよ...

main.include(*modules) -> self (18125.0)

引数 modules で指定したモジュールを後ろから順番に Object にインクルードします。

...odules Module のインスタンス( Enumerable など)を指定します。

@raise ArgumentError 継承関係が循環してしまうような include を行った場
合に発生します。

//emlist[例:][ruby]{
include
Math

hypot(3, 4) # => 5.0
//}

@see Module#include...

1.6.8から1.8.0への変更点(まとめ) (192.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...い。break が例外になる。

Proc.new {|a,b,c| p [a,b,c]}.call(1,2)
=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]...
...=> -:1: wrong # of arguments (2 for 3) (ArgumentError)
from -:1:in `call'
from -:1
ruby 1.6.8 (2002-12-24) [i586-linux]
=> -:1: wrong number of arguments (2 for 3) (ArgumentError)
from -:1:in `...
...スタンスになりました。

=== クラス階層

: ((<File::Constants>))

File::Constants は、File クラスでなく IO クラスが include するように
なりました。((<ruby-dev:20964>))

: ((<UnboundMethod>)) [compat]

UnboundMethod クラスは Method クラスのサブク...

ruby 1.6 feature (108.0)

ruby 1.6 feature ruby version 1.6 は安定版です。この版での変更はバグ修正がメイン になります。

...$; が有効にな
るのは引数省略時だけでした。

$; = ":"
p "a:b:c".split(nil)
=> -:2:in `split': bad separator (ArgumentError)
from -:2
ruby 1.6.7 (2002-03-01) [i586-linux]

=> ruby 1.6.7 (2002-07-30) [i586-linux]
["a", "b", "c"]

: 2002-06...
...0 を指定したと見なされエラーになって
いました。

1.step(2, 0.1) {|f| p f }

=> -:1:in `step': step cannot be 0 (ArgumentError)
from -:1
ruby 1.6.7 (2002-03-01) [i586-linux]

=> ruby 1.6.7 (2002-04-10) [i586-linux]
1
1.1
:...
...18>)), ((<ruby-dev:15684>)),
((<ruby-dev:15757>))

: ((<Module/include>))

モジュールが再帰的に include されないようになりました。

module Foo; end
module Bar; include Foo; end
module Foo; include Bar; end

p Foo.ancestors

=> ruby 1.6.6 (2001-12-26) [i...

Ruby用語集 (54.0)

Ruby用語集 A B C D E F G I J M N O R S Y

...と呼ぶ。
(ここでいうインスタンスは、当該のクラスやその子孫クラス、あるいは当該の
モジュールを include したクラスやその子孫クラスのインスタンスを指す)

特異メソッドは特異クラスから見ればインスタンス...
...: Oniguruma
Ruby 1.9.x で採用されていた正規表現エンジン。

: オーバーライド
: override
Ruby では上位クラスや include したモジュールで定義されているメソッドを
再定義することを「オーバーライドする」という。
オーバ...
...扱いされない。
ただしパス名には使えず、ヌル文字を含んだ文字列を File.open や
Pathname.new に与えると ArgumentError が発生する。

他の言語では文字列の終端を意味することがあるので、文字列データをやりとり
するう...

絞り込み条件を変える

NEWS for Ruby 2.1.0 (42.0)

NEWS for Ruby 2.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ルであれば false を返します。
* 拡張: Module#refine はもはや実験的な機能でなくなりました
* 拡張: Module#include と Module#prepend はパブリックメソッドになりました

* Mutex
* Mutex#owned? はもはや実験的な機能ではありませ...
...りません。
The method activates refinements in the ancestors of the argument module to
support refinement inheritance by Module#include

=== 組み込みクラスの互換性 (機能追加とバグ修正を除く)

* Hash
* 非互換: Hash#reject は将来のバージョンで...
...た。メソッドオブジェクトではありません。

* Numeric#quo
* レシーバーが to_r メソッドを持たないとき ArgumentError ではなく TypeError を発生させるようになりました。

* Proc
* Returning from lambda proc now always exits from the Proc,...

NEWS for Ruby 2.7.0 (36.0)

NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...ド引数付きで呼び出すとArgumentErrorになります。 14183

//emlist[][ruby]{
def foo(h, **nil); end; foo(key: 1) # ArgumentError
def foo(h, **nil); end; foo(**{key: 1}) # ArgumentError
def foo(h, **nil); end; foo("str" => 1) # ArgumentError
def foo(h, **nil); end; foo({key: 1}...
...するようになりました。

//emlist[][ruby]{
def bar
lambda
end
bar { puts "Hello" } #=> tried to create Proc object without a block (ArgumentError)
//}

==== その他の変更

* 始端なしRangeが実験的に導入されました。
caseやComparable#clampや定数やDSLなど...
...Range#===がString引数に対してもRange#cover?を使うようになりました。
(Ruby 2.6ではString以外の全ての型でRange#include?から変更されていました。)
15449

* RubyVM
* 削除されたメソッド
* RubyVM.resolve_feature_pathが$LOAD_PAT...

NEWS for Ruby 3.0.0 (36.0)

NEWS for Ruby 3.0.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...eyword arguments are now separated from positional arguments.
Code that resulted in deprecation warnings in Ruby 2.7 will now
result in ArgumentError or different behavior. 14183
* Procs accepting a single rest argument and keywords are no longer
subject to autosplatting. This now mat...
...ntext. 16786
* Module
* Module#include and Module#prepend now affect classes and modules that have already included or prepended the receiver, mirroring the behavior if the arguments were included in the receiver before the other modules and classes included or prepended the receiver. 9573...
...* Module#alias_method now returns the defined alias as a symbol. 17314

//emlist[][ruby]{
class C; end
module M1; end
module M2; end
C.include M1
M1.include M2
p C.ancestors #=> [C, M1, M2, Object, Kernel, BasicObject]
//}

* Mutex
* `Mutex` is now acquired per-`Fiber` instead of per-`Thr...

ruby 1.8.4 feature (36.0)

ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。

...ました。((<ruby-dev:27964>))

module Foo
def initialize
super
end
end

class Bar
include
Foo
def initialize
Foo.instance_method(:initialize).bind(self).call
end
end

Bar.new...
....4 (2005-12-01) [i686-linux]

# ArgumentError
printf("%2147483648$d\n") # -e:1:in `printf': invalid index - -2147483648$ (ArgumentError)
printf("%2147483649$d\n") # -e:1:in `printf': invalid index - -2147483647$ (ArgumentError)
printf("%4294967296$d\n")...
...# -e:1:in `printf': invalid index - 0$ (ArgumentError)

# overflow
printf("%4294967297$d\n", 1) # 1
printf("%4294967298$d\n", 1, 2) # 2

# 1.8.4 では、上記例はすべて以下のエラーになります。
# %xx$ に指定できる最大値は 214...

クラス/メソッドの定義 (36.0)

クラス/メソッドの定義 * クラス/メソッドの定義: * class * singleton_class * module * method * operator * nest_method * eval_method * singleton_method * class_method * limit * 定義に関する操作: * alias * undef * defined

...い。Net を include できるなどのため)
module Net
class HTTP
end
class FTP
end
end

obj = Net::HTTP.new

# あるいは

include
Net
obj = HTTP.new

# 以下のような使い方は組み込みのクラスにも見られる
# 利用者は File::Constants を include することで...
...直接 RDONLY と書くことができる。
class File
module Constants
RDONLY = 0
WRONLY = 1
end
include
Constants
end

File.open("foo", File::RDONLY)

# あるいは

include
File::Constants
File.open("foo", RDONLY)

# 上記はあくまでも例である。実際の File.open で...
...ef foo(x, y = 1) # 2番目の引数yにデフォルト値を指定
10 * x + y
end
p foo(1, 5) #=> 15
p foo(3) #=> 31
p foo #=> ArgumentError (wrong number of arguments)
//}

デフォルト値を指定する引数の位置は、1つの連続した区間になっている必要があ...

絞り込み条件を変える

NEWS for Ruby 3.1.0 (24.0)

NEWS for Ruby 3.1.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。

...protected? が追加されました。 11689

* Module
* 変更されたメソッド
* Module#prepend はレシーバが既に引数をincludeしている場合、継承ツリーを変更するようになりました。レシーバが既に引数をprependしている場合、継承ツ...
...ックを開始するための offset: キーワード引数を渡せるようになりました。 offset が文字列の範囲外の場合、 ArgumentError 例外が発生します。 18254

* Thread
* 新規メソッド
* Thread#native_thread_id が追加されました。 17853

*...
...換されるようになりました。

//emlist[Time.new][ruby]{
Time.new(2021, 12, 25, "+07:30")
#=> invalid value for Integer(): "+07:30" (ArgumentError)
//}

* Ruby 3.0 以前では、予期しない結果の 2021-12-25 07:00:00 が返されました。 2021-12-25 07:30:00 や 2021-12-25...
<< 1 2 > >>