るりまサーチ

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

別のキーワード

  1. format spec
  2. installer spec
  3. format spec=
  4. oldformat spec
  5. oldformat spec=

ライブラリ

クラス

キーワード

検索結果

リテラル (23036.0)

リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent

...タ a を表す String

: ?\M-\C-a

メタ-コントロール a を表す String

===[a:command] コマンド出力

//emlist[例][ruby]{
`date`
%x{ date }
//}

バッククォート(`)で囲まれた文字列は、ダブルクォー
トで囲まれた文字列と同様にbackslash
の解釈とexp...
...print <<EOS
The price is #{$price}.
EOS

# 式展開はできない
print <<'EOS'
The price is #{$price}.
EOS

# コマンドを実行
print <<`EOC`
date

diff test.c.org test.c
EOC
//}

文字列リテラルのそれぞれの性質に関しては
string、
exp、
backslash、
command
を参照して...
...name is #{myname}/o
%r|Ruby|
//}

/で囲まれた文字列は正規表現です。正規表現として解釈される
メタ文字についてはspec/regexpを参照してください。

終りの/の直後の文字は正規表現に対するオプションになります。
オプションの...
...とができます。

//emlist[][ruby]{
expected_result = <<~SQUIGGLY_HEREDOC
This would contain specially formatted text.

That might span many lines
SQUIGGLY_HEREDOC
# => "This would contain specially formatted text.\n" + "\n" + "That might span many lines\n"
//}

最もインデントが少...

パターンマッチ (23006.0)

パターンマッチ * patterns * variable_binding * variable_pinning * matching_non_primitive_objects * guard_clauses * current_feature_status * pattern_syntax * some_undefined_behavior_examples

...d

def deconstruct
puts "deconstruct called"
[@x, @y]
end

def deconstruct_keys(keys)
puts "deconstruct_keys called with #{keys.inspect}"
{x: @x, y: @y}
end
end

case Point.new(1, -2)
in px, Integer # パターンと変数への束縛も動きます
"matched: #{px}"
else...
...は deconstruct や deconstruct_keys を実装しています。

MatchData#deconstruct
MatchData#deconstruct_keys
Time#deconstruct_keys
Date
#deconstruct_keys
Date
Time#deconstruct_keys

===[a:guard_clauses] ガード節

if を使って、パターンにマッチしたときに評価される追加...

Gem::Specification#date -> Time (21101.0)

日付を返します。

日付を返します。

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

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

...チに使用する名前の配列を指定します。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...
...g 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 (11006.0)

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

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

//emlist[例][ruby]{
dt = DateTime.new(2022, 10, 5, 13, 30)

if dt in wday: 1..5, hour: 10..18 # deconstruct_keys が使われます
puts "Working time"
end
#=> "Working time"...
...> "working day in month 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...

絞り込み条件を変える

Gem::Specification#date=(date) (9218.0)

@param date 日付をセットします。デフォルトは今日です。

...@param date 日付をセットします。デフォルトは今日です。...

Gem::Specification#validate -> bool (9100.0)

必須属性のチェックと自身の基本的な正当性チェックを行います。

...ェックと自身の基本的な正当性チェックを行います。

チェックにパスした場合は常に true を返します。そうでない場合は例外が発生します。

@raise Gem::InvalidSpecificationException チェックにパスしなかった場合に発生します。...

rss (174.0)

RSS を扱うためのライブラリです。

...ライブラリです。

=== 参考

* RSS 0.91 http://backend.userland.com/rss091
* RSS 1.0 http://purl.org/rss/1.0/spec
* RSS 2.0 http://www.rssboard.org/rss-specification
* Atom 1.0 https://www.ietf.org/rfc/rfc4287.txt

=== 注意

RSS ParserはRSS 0.9x/1.0/2.0, Atom 1.0 をサポー...
...ample.com/article.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end
end

サンプル中の

item.date = ...



item.dc_date = ...

でも構いません.#dc_date=は#date=の単なる別名で
す.

===== さらにエントリを追加...
...cle.html"
item.title = "Sample Article"
item.date = Time.parse("2004/11/1 10:10")
end

maker.items.new_item do |item|
item.link = "http://example.com/article2.html"
item.title = "Sample Article2"
item.date = Time.parse("2004/11/2 10:10")
end
end

===== エ...

Range#===(obj) -> bool (48.0)

始端と終端の中に obj があるとき、true を返します。 そうでないとき、false を返します。

...りません。

//emlist[例][ruby]{
require 'date'
p (Date.today - 100...Date.today + 100).include?(DateTime.now) #=> false
p (Date.today - 100...Date.today + 100).cover?(DateTime.now) #=> true
p (Date.today - 100...Date.today + 100) === DateTime.now #=> true
# 2.5 以前は、=== は...
...、include? と同じく比較できず false を返していました。
//}


@see d:spec/control#case
@see Range#include?, Range#cover?...
...//emlist[例][ruby]{
p ('a'..'z').include? 'at' #=> false
p ('a'..'z').cover? 'at' #=> true
p ('a'..'z') === 'at' #=> true
# 2.6 以前は、=== は、include? と同じく比較できず false を返していました。
//}

@see d:spec/control#case
@see Range#include?, Range#cover?...

yaml (24.0)

構造化されたデータを表現するフォーマットであるYAML (YAML Ain't Markup Language) を扱うためのライブラリです。

...e 'date'

str_l = <<~YAML_EOT
Tanaka Taro: {age: 35, birthday: 1970-01-01}
Suzuki Suneo: {
age: 13,
birthday: 1992-12-21
}
YAML_EOT

str_r = {}
str_r["Tanaka Taro"] = {
"age" => 35,
"birthday" => Date.new(1970, 1, 1)
}
str_r["Suzuki Suneo"] = {
"age" => 13,
"birthday" => Date.n...
...ような文字列はそのまま Symbol として扱える
* "y" や "n" は真偽値として扱われない

=== 参考

YAML Specification

* https://yaml.org/spec/
* https://yaml.org/type/

YAML4R

* http://yaml4r.sourceforge.net/
* http://yaml4r.sourceforge.net/cookbook/(http://yaml.org/Y...

絞り込み条件を変える