るりまサーチ

最速Rubyリファレンスマニュアル検索!
29件ヒット [1-29件を表示] (0.139秒)
トップページ > クエリ:c[x] > クエリ:string[x] > クエリ:method[x] > クエリ:public_class_method[x]

別のキーワード

  1. _builtin define_method
  2. irb/input-method gets
  3. irb/input-method new
  4. irb/input-method readable_atfer_eof?
  5. irb/input-method encoding

ライブラリ

クラス

検索結果

Module#public_class_method(*name) -> self (30370.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...ic に変更します。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
c
lass Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMethodE...
...rror: private method `foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

Module#public_class_method(names) -> self (30370.0)

name で指定したクラスメソッド (クラスの特異メソッド) の 可視性を public に変更します。

...ic に変更します。

@param name 0 個以上の String または Symbol を指定します。
@param names 0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
c
lass Foo
def self.foo
"foo"
end

private_class_method :foo
end

Foo.foo # NoMethodE...
...rror: private method `foo' called for Foo:Class

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...

NEWS for Ruby 3.0.0 (486.0)

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

...nal arguments.
C
ode 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 matches the behavior of Procs
accepting a sing...
...[ruby]{
pr = proc{|*a, **kw| [a, kw]}

pr.call([1])
# 2.7 => [[1], {}]
# 3.0 => [[[1]], {}]

pr.call([1, {a: 1}])
# 2.7 => [[1], {:a=>1}] # and deprecation warning
# 3.0 => a=>1}, {}]
//}

* Arguments forwarding (`...`) now supports leading arguments.
16378

//emlist{
def method_missing(meth,...
...a #=> 0

{b: 0, c: 1} => {b:}
p b #=> 0
//}

//emlist{
# version 3.0
0 in 1 #=> false

# version 2.7
0 in 1 #=> raise NoMatchingPatternError
//}

* Find-pattern is added. [EXPERIMENTAL]
16828

//emlist{
c
ase ["a", 1, "b", "c", 2, "d", "e", "f", 3]
in [*pre, String => x, String => y, *post]...