るりまサーチ

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

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 > >>

Rake::TaskArguments#names -> Array (21120.0)

パラメータ名のリストを返します。

...パラメータ名のリストを返します。

//emlist[][ruby]{
# Rakefile での記載例とする

t
ask default: :test_rake_app
t
ask :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arguments.names # => ["name1", "name2"]
end

//}...

IRB::ExtendCommand::Help#execute(*names) -> nil (12236.0)

RI から Ruby のドキュメントを参照します。

...RI から Ruby のドキュメントを参照します。

irb(main):001:0> help String#match
...

@param names 参照したいクラス名やメソッド名などを文字列で指定します。

names
を指定しなかった場合は、RI を対話的なモードで起動します。メソ...
...Enter the method name you want to look up.
You can use tab to autocomplete.
Enter a blank line to exit.

>> String#match
String#match

(from ruby core)
------------------------------------------------------------------------------
str.match(pattern) -> matchdata or nil
str...
....match(pattern, pos) -> matchdata or nil
......

Rake::TaskManager#in_namespace(name) {|name_space| ... } -> Array (9131.0)

与えられた名前の名前空間でブロックを評価します。

...ます。

@param name 名前を指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

t
ask default: :test_rake_app

names
pace :sample do
def hoge
puts "hoge"
end

end


t
ask :test_rake_app do
t
ask.application.in_namespace("sample") do
hoge # => "hoge"
end

end

//}...

Rake::NameSpace#tasks -> Array (9125.0)

タスクのリストを返します。

...タスクのリストを返します。

//emlist[][ruby]{
# Rakefile での記載例とする

names
pace :ns do |ns|
t
ask :ts1 do
end

t
ask :ts2 do
end


ns.tasks # => [<Rake::Task ns:ts1 => []>, <Rake::Task ns:ts2 => []>]
end

//}...

Module#ruby2_keywords(method_name, ...) -> nil (6260.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

... the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword arguments, t...
...ent is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed through the meth...
...od to
other methods.

T
his should only be used for methods that delegate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

T
his method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby ve...

絞り込み条件を変える

Time#deconstruct_keys(array_of_names_or_nil) -> Hash (6256.0)

パターンマッチに使用する名前と値の Hash を返します。

...month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :subsec
* :dst
* :zone

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
t
= Time.utc(2...
...f t in wday: 3, day: ..7 # deconstruct_keys が使われます
puts "first Wednesday of the month"
end

#=> "first Wednesday of the month" が出力される

case t
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end
...
...#=> "working day in month 10" が出力される

# クラスのチェックと組み合わせて利用することもできます
if t in Time(wday: 3, day: ..7)
puts "first Wednesday of the month"
end

//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Data#deconstruct_keys(array_of_names_or_nil) -> Hash (6238.0)

self のメンバの名前と値の組を Hash で返します。

...と値の組を Hash で返します。

//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)

distance = Measure.new(10, 'km')
distance.deconstruct_keys(nil) # => {:amount=>10, :unit=>"km"}
distance.deconstruct_keys([:amount]) # => {:amount=>10}
//}

このメソッドは以下のよう...
...す。

//emlist[例][ruby]{
Measure = Data.define(:amount, :unit)
distance = Measure.new(10, 'km')

case distance
in amount:, unit: 'km' # 裏側で #deconstruct_keys を呼ぶ
puts "It is #{amount} kilometers away"
else
puts "Don't know how to handle it"
end

# "It is 10 kilometers away" が表...
...se distance
in Measure(amount:, unit: 'km')
puts "It is #{amount} kilometers away"
# ...
end

//}

@param array_of_names_or_nil 返り値に含めるメンバの名前の配列を指定します。nil の場合は全てのメンバを意味します。

[注意] 本メソッドの記述は Data の...

Date#deconstruct_keys(array_of_names_or_nil) -> Hash (6232.0)

パターンマッチに使用する名前と値の Hash を返します。

...:month
* :day
* :yday
* :wday

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
d = Date.new(2022, 10, 5)

if d in wday: 3, day: ..7 # deconstruct_keys...
...使われます
puts "first Wednesday of the month"
end

#=> "first Wednesday of the month" が出力される

case d
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end

#=> "working day in month 10" が出力され...
...

# クラスのチェックと組み合わせて利用することもできます
if d in Date(wday: 3, day: ..7)
puts "first Wednesday of the month"
end

//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

DateTime#deconstruct_keys(array_of_names_or_nil) -> Hash (6232.0)

パターンマッチに使用する名前と値の Hash を返します。

...:month
* :day
* :yday
* :wday
* :hour
* :min
* :sec
* :sec_fraction
* :zone

@param array_of_names_or_nil パターンマッチに使用する名前の配列を指定します。nil の場合は全てをパターンマッチに使用します。

//emlist[例][ruby]{
dt = DateTime.n...
...dt in wday: 1..5, hour: 10..18 # deconstruct_keys が使われます
puts "Working time"
end

#=> "Working time" が出力される

case dt
in year: ...2022
puts "too old"
in month: ..9
puts "quarter 1-3"
in wday: 1..5, month:
puts "working day in month #{month}"
end

#=> "working day in mont...
...h 10" が出力される

# クラスのチェックと組み合わせて利用することもできます
if dt in DateTime(wday: 1..5, hour: 10..18, day: ..7)
puts "Working time, first week of the month"
end

//}

@see d:spec/pattern_matching#matching_non_primitive_objects...

Module#private(names) -> Array (6232.0)

メソッドを private に設定します。

...メソッドを private に設定します。

引数なしのときは今後このクラスまたはモジュール定義内で新規に定義さ
れるメソッドを関数形式でだけ呼び出せるように(private)設定します。

引数が与えられた時には引数によって指定...
...されたメソッドを private に
設定します。

可視性については d:spec/def#limit を参照して下さい。

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

@raise NameEr...
...

//emlist[例][ruby]{
class Foo
def foo1() 1 end # デフォルトでは public
private # 可視性を private に変更
def foo2() 2 end # foo2 は private メソッド
end


foo = Foo.new
p foo.foo1 # => 1
p foo.foo2 # => private method `foo2' cal...

絞り込み条件を変える

Module#private_class_method(names) -> self (6226.0)

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

...性を private に変更します。

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

//emlist[例][ruby]{
module Foo
def self.foo; end
end


Foo.singleton_class.private_method_defined?(:f...
...oo) # => false
Foo.private_class_method(:foo) # => Foo
Foo.singleton_class.private_method_defined?(:foo) # => true
//}...

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

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

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

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


private_class_method :foo
end


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

Foo.public_class_method(:foo) # => Foo
Foo.foo # => "foo"
//}...
<< 1 2 3 > >>