るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

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

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

...0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class Foo
d
ef self.foo
"foo"
end

private_class_method :foo
end

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

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

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

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

...0 個以上の String または Symbol を Array で指定します。

//emlist[例][ruby]{
class Foo
d
ef self.foo
"foo"
end

private_class_method :foo
end

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

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

NEWS for Ruby 3.0.0 (18.0)

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

...語仕様の変更

* Keyword 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 aut...
...t argument and no keywords.
16166

//emlist[][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 argument...
...nd 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#public, Module#protected, Module#private, Module#public_class_method, Modu...