るりまサーチ

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

別のキーワード

  1. string []=
  2. string slice
  3. string []
  4. string slice!
  5. string gsub!

検索結果

<< 1 2 > >>

main.using(module) -> self (18119.0)

引数で指定したモジュールで定義された拡張を有効にします。

...ents_rdoc.html#label-Scope

@param module 有効にするモジュールを指定します。

//emlist[例][ruby]{
module Sloth
refine String do
def downcase
self
end
end
end

"ABC".downcase # => "abc"

using
Sloth

"ABC".downcase # => "ABC"
//}

@see Module#refine, Module#using...

1.6.8から1.8.0への変更点(まとめ) (666.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への変更点(まとめ)/サポートプラットフォームの追加>))

...fix として 0d が追加されました。
8進リテラルの prefix として 0 以外に 0o が追加されました。

Integer(), String#to_i、String#oct もこの prefix を認識します。

: ((<メソッド引数の & 修飾|メソッド呼び出し/イテレータ>)) [compat]
: ((<...
...を抜け、n が yield の戻り値になります。

: to_str [compat]

to_str を定義したオブジェクトはより広範囲にStringとして振舞うように
なりました。

文字列を引数に取るほとんどの組み込みメソッドは、to_str による暗黙の...
...新たに追加されました。
((<iconv>)), ((<tsort>)), ((<StringIO>)), ((<strscan>)),
((<fileutils>)), racc/*

: ((<benchmark>)) [new]
added

: Curses [lib] [compat]

Updated. New methods and constants for using the mouse, character
attributes, colors and key codes have been a...

NEWS for Ruby 3.0.0 (288.0)

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

...", "f", 3]
in [*pre, String => x, String => y, *post]
p pre #=> ["a", 1]
p x #=> "b"
p y #=> "c"
p post #=> [2, "d", "e", "f", 3]
end
//}

* Endless method definition is added. [EXPERIMENTAL]
16746

//emlist{
def square(x) = x * x
//}

* Interpolated String literals are no lo...
...nger frozen when
`# frozen-string-literal: true` is used. 17104
* Magic comment `shareable_constant_value` added to freeze constants.
See {Magic Comments}[rdoc-ref:doc/syntax/comments.rdoc@Magic+Comments] for more details.
17273
* A {static analysis}[rdoc-label:label-Static+analysis]...
...* `Mutex` is now acquired per-`Fiber` instead of per-`Thread`. This change should be compatible for essentially all usages and avoids blocking when using a scheduler. 16792
* Proc
* Proc#== and Proc#eql? are now defined and will return true for separate Proc instances if the procs were created...

Ruby用語集 (90.0)

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

...cent

: 0 オリジン
: zero-based
番号が 0 から始まること。

例えば、
Array や Vector、Matrix などの要素の番号、
String
における文字の位置、
といったものは 0 オリジンである。

: 1 オリジン
: one-based
番号が 1 から始まるこ...
...efinement
既存のクラスやモジュールを特定のスコープでのみ改変する仕組み。

参照:Module#refine、Module#using、main.using

: Ruby Central
Rubyのサポートと世界の Ruby コミュニティーの支援を専門とする非営利組織。
RubyConf(Inter...
...
オブジェクトではない。

ただし、メソッド、ブロックはそれぞれオブジェクト化できる。

なお、「String オブジェクト」のような、クラス名+「オブジェクト」の
形の表現は、そのクラスのインスタンスを指す。...

NEWS for Ruby 2.0.0 (84.0)

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

...* String
* 追加: String#b エンコーディングを ASCII-8BIT に設定したコピーされた文字列を返します
* 返り値変更:
* String#lines Enumerator ではなく Array を返します
* String#chars Enumerator ではなく Array を返します
* String...
...#codepoints Enumerator ではなく Array を返します
* String#bytes Enumerator ではなく Array を返します

* Struct
* 追加: Struct#to_h インスタンス変数の名前と値をハッシュのキーと値にしたハッシュを生成して返します

* Thread
*...
...* added main.using, which imports refinements into the current file or
eval string. [experimental]

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

* Array#values_at
上を参照

* String#lines, String#chars, String#codepoints, String#bytes
...

絞り込み条件を変える

CSV (60.0)

このクラスは CSV ファイルやデータに対する完全なインターフェイスを提供します。

...込み
csv_string = CSV.generate do |csv|
csv << ["row", "of", "CSV", "data"]
csv << ["another", "row"]
# ...
end
//}

=== 一行変換

//emlist[][ruby]{
require 'csv'

csv_string = ["CSV", "data"].to_csv # => "CSV,data"
csv_array = "CSV,String".parse_csv # => ["CSV", "String"]
//}

===...
...%w{my data here} } # to a String
CSV($stderr) { |csv_err| csv_err << %w{my data here} } # to $stderr
//}

=== CSV と文字エンコーディング (M17n or Multilingualization)

This new CSV parser is m17n savvy. The parser works in the Encoding of the IO
or String object being read from or...
...into a String with an Encoding
that is not ASCII compatible. There's no existing data for CSV to use to
prepare itself and thus you will probably need to manually specify the desired
Encoding for most of those cases. It will try to guess using the fields in a
row of output though, when using CSV::...

NEWS for Ruby 2.7.0 (60.0)

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

...告が表示されるようになりました。

//emlist[][ruby]{
def foo
proc
end
foo { puts "Hello" } #=> warning: Capturing the given block using Kernel#proc is deprecated; use `&block` instead
//}

* 非推奨に関する警告を止めたい場合は、コマンドライン引数に...
...)

where(sales: ..100)
//}

* 「$;」にnil以外の値を設定すると警告が出るようになりました。 14240
nil以外の時はString#splitで参照した時も警告が出ます。
この警告は「-W:no-deprecated」オプションで止められます。

* 「$,」にn...
...同じModuleは常に同じStringを返します。
この変更は実験的です。 16150

* NilClass / TrueClass / FalseClass
* 変更されたメソッド
* NilClass#to_s, TrueClass#to_s, FalseClass#to_sが
常にfreezeされたStringを返すようになりまし...

NEWS for Ruby 2.1.0 (54.0)

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

...受け付けるようになりました

* Kernel
* 追加: Kernel#singleton_method(Object#singleton_method)

* Module
* 追加: Module#using, which activates refinements of the specified module only
in the current class or module definition.
* 追加: Module#singleton_class?...
...k_getres

* String
* "literal".freeze は同じオブジェクトを返すように最適化されました。
* 追加: String#scrub, String#scrub! 不正なバイト列を検証して修正します。
古いバージョンのRubyと一緒に使いたいときは string-scrub gem...
...シンボルは freeze されるようになりました

* pack/unpack (Array/String)
* プラットフォームが対応していれば Q! と q! は long long 型を表します

* toplevel
* main.using はもはや実験的な機能ではありません。
The method activates...

rubygems/security (36.0)

このライブラリは暗号署名を RubyGems パッケージに使用するために使用します。

...以下のように "-P HighSecurity" オプションを
付けて Gem をインストールしてみてください。

# install the gem with using the security policy "HighSecurity"
$ sudo gem install Imlib2-Ruby-0.5.0.gem -P HighSecurity

この -P オプションはセキュリティポリ...
...することが出来ます。さあ、上述の
インストールコマンドをもう一度実行してください。

# install the gem with using the HighSecurity policy
# (今度はなんの問題もありません)
$ sudo gem install Imlib2-Ruby-0.5.0.gem -P HighSecurity

今回は、R...
...追加します。
-l, --list 信頼している証明書のリストを表示します。
-r, --remove STRING STRING を含む証明書を削除します。
-b, --build EMAIL_ADDR EMAIL_ADDR に対する秘密鍵や自己署名証明書...

net/smtp (30.0)

メールを送信するためのプロトコル SMTP (Simple Mail Transfer Protocol) を扱うライブラリです。

...rom@example.com>
To: Dest Address <to@example.net>
Subject: test mail
Date: Sat, 23 Jun 2001 16:26:43 +0900
Message-Id: <unique.message.id.string@yourhost.example.com>

This is a test mail.
EndOfMail
}

==== セッションを終了する

メールを送ったら Net::SMTP#finish...
...
File のように GC 時に勝手に close されることもありません。

# using SMTP#finish
require 'net/smtp'
smtp = Net::SMTP.start('smtp.example.com', 25)
smtp.send_message mail_string, 'from@example.com', 'to@example.net'
smtp.finish

またブロック付きの Net::SMTP....
...能な限りブロック付きの start を使うのがよいでしょう。

# using block form of SMTP.start
require 'net/smtp'
Net::SMTP.start('smtp.example.com', 25) {|smtp|
smtp.send_message mail_string, 'from@example.com', 'to@example.net'
}

==== 文字列以外からの送信...

絞り込み条件を変える

Refinement#import_methods(*modules) -> self (18.0)

モジュールからメソッドをインポートします。

...uby]{
module StrUtils
def indent(level)
' ' * level + self
end
end

module M
refine String do
import_methods StrUtils
end
end

using
M
p "foo".indent(3) # => " foo"

module M
refine String do
import_methods Enumerable
# Can't import method which is not defined with Ruby c...
<< 1 2 > >>