種類
- 文書 (86)
- インスタンスメソッド (55)
- ライブラリ (44)
ライブラリ
- ビルトイン (55)
クラス
-
Encoding
:: Converter (44) - Symbol (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Marshal フォーマット (11)
-
NEWS for Ruby 2
. 7 . 0 (5) -
NEWS for Ruby 3
. 0 . 0 (4) - Ruby用語集 (11)
-
primitive
_ convert (44) -
rexml
/ parsers / pullparser (11) -
rexml
/ parsers / sax2parser (11) -
rexml
/ parsers / streamparser (11) -
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 9 feature (11) - yaml (11)
- リテラル (11)
- 正規表現 (11)
検索結果
先頭5件
- Symbol
# encoding -> Encoding - Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer) -> Symbol - Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol - Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol - Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol
-
Symbol
# encoding -> Encoding (39254.0) -
シンボルに対応する文字列のエンコーディング情報を表現した Encoding オブ ジェクトを返します。
...シンボルに対応する文字列のエンコーディング情報を表現した Encoding オブ
ジェクトを返します。
例:
# encoding: utf-8
:foo.encoding # => #<Encoding:US-ASCII>
:あかさたな.encoding # => #<Encoding:UTF-8>
@see String#encoding... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer) -> Symbol (3152.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Conv......lete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''
begin
ret = ec.primitive_convert(src, dst)
p [ret, src, ds... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset) -> Symbol (3152.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Conv......lete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''
begin
ret = ec.primitive_convert(src, dst)
p [ret, src, ds... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize) -> Symbol (3152.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Conv......lete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''
begin
ret = ec.primitive_convert(src, dst)
p [ret, src, ds... -
Encoding
:: Converter # primitive _ convert(source _ buffer , destination _ buffer , destination _ byteoffset , destination _ bytesize , options) -> Symbol (3152.0) -
エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。
...ッドです。
可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。
@param source_buffer 変換元文字列のバッファ
@param destination_buff......表す Symbol
options には以下が指定できます。
: hash form
:partial_input => true # source buffer may be part of larger source
:after_output => true # stop conversion after output before input
: integer form
Encoding::Converter::PARTIAL_INPUT
Encoding::Conv......lete_input
* :undefined_conversion
* :after_output
* :destination_buffer_full
* :source_buffer_empty
* :finished
//emlist[][ruby]{
ec = Encoding::Converter.new("UTF-8", "EUC-JP")
src = "abc\x81あいう\u{20bb7}\xe3"
dst = ''
begin
ret = ec.primitive_convert(src, dst)
p [ret, src, ds... -
Marshal フォーマット (138.0)
-
Marshal フォーマット フォーマットバージョン 4.8 を元に記述しています。
...Array, Hash のサブクラス (インスタンス変数なし)
'C' で始まるデータ構造になります。
//emlist{
| 'C' | クラス名(Symbol)の dump | 親クラスのインスタンスの dump |
//}
//emlist[例 1][ruby]{
class Foo < Array # (or String, Regexp, Hash)
end
p Marshal.dum......インスタンス変数は dump されなくなるので、_dump/_load で対応する必要があります。
//emlist{
| 'u' | クラス名(Symbol)の dump | _dump の結果の長さ(Fixnum形式) | _dump が返す値 |
//}
//emlist[][ruby]{
# coding: ascii-8bit
class Foo
def self._load
en...... encoding が 'encoding' という
「@」のつかない内部的なインスタンス変数としてダンプされます。
//emlist[例: euc-jp の時][ruby]{
p Marshal.dump("hogehoge".encode("euc-jp")).unpack("x2 a a c a8 c a ca8 aca*")
# => ["I", "\"", 13, "hogehoge", 6, ":", 13, "encoding",... -
ruby 1
. 8 . 4 feature (114.0) -
ruby 1.8.4 feature ruby 1.8.4 での ruby 1.8.3 からの変更点です。
...latform]: 対応プラットフォームの追加
== 目次
* ((<ruby 1.8.4 feature/Ruby本体>))
* ((<ruby 1.8.4 feature/Symbol [bug]>))
* ((<ruby 1.8.4 feature/Symbol [bug]>))
* ((<ruby 1.8.4 feature/super [bug]>))
* ((<ruby 1.8.4 feature/正規表現 [bug]>))
* ((<ruby 1.8.4 feature/......re/Sun [bug]>))
* ((<ruby 1.8.4 feature/IA64 [bug]>))
== Ruby本体
: Symbol [bug]
# * parse.y (dsym): prohibit empty symbol literal by interpolation.
# fixed: [ruby-talk:166529]
式展開で空のSymbolを作ることができたバグの修正。 ((<ruby-talk:166529>))......は非互換となります.
: REXML [compat]
#Fri Dec 9 23:31:02 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
#
# * lib/rexml/encoding.rb (encoding=): give priority to particular
# conversion to iconv. [ruby-core:06520]
日本語のエンコーディング変換にiconvよ... -
正規表現 (112.0)
-
正規表現 * metachar * expansion * char * anychar * string * str * quantifier * capture * grouping * subexp * selector * anchor * cond * option * encoding * comment * free_format_mode * absenceop * list * specialvar * references
...pansion
* char
* anychar
* string
* str
* quantifier
* capture
* grouping
* subexp
* selector
* anchor
* cond
* option
* encoding
* comment
* free_format_mode
* absenceop
* list
* specialvar
* references
正規表現(regular expression)は文字列のパター......を付けることができます。
(?<name>pat)もしくは(?'name'pat)と記述します。キャプチャした文字列は
MatchData#[] に Symbol を渡すことで参照できます。
これは名前付きキャプチャと呼ばれます。
//emlist[][ruby]{
m = /\$(?<dollars>\d+)\.(?<cen......ンコーディングのルールに従う)
d,a,u のオプションは正規表現直後に置く方式では指定ができません。
===[a:encoding] エンコーディング
通常、正規表現のエンコーディングはソースコードエンコーディングと
同じであると見... -
NEWS for Ruby 2
. 7 . 0 (60.0) -
NEWS for Ruby 2.7.0 このドキュメントは前回リリース以降のバグ修正を除くユーザーに影響のある機能の変更のリストです。
...",
"age": 30,
"children": [{ "name": "Bob", "age": 2 }]
}
END
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: name, age: age}]}
p name #=> "Bob"
p age #=> 2
JSON.parse(json, symbolize_names: true) in {name: "Alice", children: [{name: "Charlie", age: age}]}
#=> No......}
* メソッドがキーワード引数を受け取るがdouble splat引数は受け取らず、
かつ、メソッド呼び出しでSymbolと非Symbolの混ざったハッシュを渡す
(もしくはハッシュをdouble splatでキーワードとして渡す)場合、
ハッ......NUL文字区切りのグロブパターンを受け付けなくなりました。
代わりにArrayを使ってください。 14643
* Encoding
* 新規エンコーディング
* CESU-8が追加されました。 15931
* Enumerable
* 新規メソッド
* Enumerable#... -
リテラル (52.0)
-
リテラル * num * string * backslash * exp * char * command * here * regexp * array * hash * range * symbol * percent
...リテラル
* num
* string
* backslash
* exp
* char
* command
* here
* regexp
* array
* hash
* range
* symbol
* percent
数字の1や文字列"hello world"のようにRubyのプログラムの中に直接
記述できる値の事をリテラルといいます。
===[a:n......要があります。
: ?あ
文字 あ を表す String
: ?\u3042
文字 あ を表す String。
文字のエンコーディングはEncoding::UTF_8に設定されます。
: ?\C-a
コントロール a を表す String
: ?\M-a
メタ a を表す String
: ?\M-\C-a
メタ-コ......。
===[a:symbol] シンボル
//emlist[例][ruby]{
# (シンボルの例)
:class
:lvar
:method!
:andthisis?
:$gvar
:@ivar
:@@cvar
:+
//}
文法:
`:' 識別子
`:' 変数名
`:' 演算子
Symbolクラスのインスタンス。
ある文字列とSymbolオブジェ...