別のキーワード
ライブラリ
- ビルトイン (2025)
- csv (72)
- etc (12)
-
irb
/ context (24) - matrix (104)
- objspace (12)
- ostruct (19)
- psych (34)
-
rexml
/ document (12) -
ripper
/ lexer (36)
クラス
- BasicObject (72)
- Binding (47)
- CSV (60)
-
CSV
:: Table (12) - Data (18)
-
Encoding
:: Converter (48) -
IRB
:: Context (24) - MatchData (1)
- Matrix (104)
- Method (36)
- Module (660)
- Object (276)
- OpenStruct (19)
- Proc (12)
- Regexp (12)
- Ripper (12)
-
Ripper
:: Lexer (24) - RubyVM (12)
-
RubyVM
:: AbstractSyntaxTree :: Node (7) -
RubyVM
:: InstructionSequence (12) - SignalException (36)
- String (78)
- Struct (139)
- Symbol (83)
- Thread (32)
- TracePoint (60)
- UnboundMethod (24)
モジュール
- Enumerable (72)
- Etc (12)
- GC (48)
- Kernel (156)
- ObjectSpace (60)
- Psych (34)
- Signal (24)
キーワード
- % (12)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - <=> (12)
- =~ (12)
-
DEFAULT
_ PARAMS (12) - ExternalEntity (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 1 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 4 . 0 (9) -
NEWS for Ruby 2
. 6 . 0 (7) -
NEWS for Ruby 2
. 7 . 0 (6) -
NEWS for Ruby 3
. 0 . 0 (5) - Ruby プログラムの実行 (12)
- Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (12)
- Ruby用語集 (12)
- [] (36)
- []= (12)
-
_ _ callee _ _ (12) -
_ _ method _ _ (12) -
_ _ send _ _ (24) -
alias
_ method (12) -
all
_ symbols (12) - attr (36)
-
attr
_ accessor (12) -
attr
_ reader (12) -
attr
_ writer (12) - autoload (24)
- autoload? (24)
-
callee
_ id (12) - casecmp (12)
- casecmp? (9)
-
class
_ variable _ defined? (12) -
class
_ variable _ get (12) -
class
_ variable _ set (12) -
class
_ variables (12) - clone (12)
- collect (14)
- collect! (14)
-
const
_ defined? (12) -
const
_ get (12) -
const
_ missing (12) -
const
_ set (12) -
const
_ source _ location (12) - constants (24)
- define (6)
-
define
_ method (24) -
define
_ singleton _ method (24) -
deprecate
_ constant (12) - downcase (9)
- dup (12)
- each (24)
-
each
_ object (48) -
each
_ pair (24) -
each
_ with _ index (24) -
end
_ with? (6) - equal? (12)
- event (12)
- fetch (8)
- format (12)
-
global
_ variables (12) - hash (12)
-
header
_ convert (36) -
header
_ converters (12) - inject (36)
-
instance
_ method (12) -
instance
_ methods (12) -
instance
_ variable _ defined? (12) -
instance
_ variable _ get (12) -
instance
_ variable _ set (12) -
instance
_ variables (12) - intern (12)
-
json
/ add / symbol (12) - key? (12)
-
latest
_ gc _ info (24) - lex (24)
- load (15)
-
local
_ variable _ defined? (12) -
local
_ variable _ get (12) -
local
_ variable _ set (12) -
local
_ variables (23) - logger (12)
- map (14)
- map! (14)
- match (24)
- match? (18)
- members (30)
- method (12)
-
method
_ added (12) -
method
_ defined? (12) -
method
_ id (12) -
method
_ missing (12) -
method
_ removed (12) -
method
_ undefined (12) - methods (12)
- mode (12)
-
module
_ function (36) - name (29)
-
named
_ captures (1) - new (84)
-
object
_ id (12) -
original
_ name (24) - parameters (24)
- parse (12)
-
primitive
_ convert (48) - private (48)
-
private
_ class _ method (24) -
private
_ constant (12) -
private
_ instance _ methods (12) -
private
_ method _ defined? (12) -
prompt
_ mode (12) -
prompt
_ mode= (12) -
protected
_ method _ defined? (12) - public (48)
-
public
_ class _ method (24) -
public
_ constant (12) -
public
_ instance _ method (12) -
public
_ method (12) -
public
_ method _ defined? (12) -
public
_ send (24) -
reachable
_ objects _ from (12) - reduce (36)
-
remove
_ class _ variable (12) -
remove
_ const (12) -
remove
_ method (12) -
respond
_ to? (12) -
respond
_ to _ missing? (12) -
rexml
/ parsers / pullparser (12) -
rexml
/ parsers / sax2parser (12) -
rexml
/ parsers / streamparser (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (19) - send (24)
-
set
_ trace _ func (12) -
singleton
_ class (12) -
singleton
_ method (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12) -
singleton
_ methods (12) - sprintf (12)
- sprintf フォーマット (12)
-
start
_ with? (6) - stat (24)
- table (12)
-
to
_ a (12) -
to
_ h (44) -
to
_ proc (12) -
to
_ sym (12) - trace (12)
-
trace
_ var (36) - trap (24)
- type (7)
- uname (12)
-
undef
_ method (12) -
untrace
_ var (12) - yaml (12)
- クラス/メソッドの定義 (12)
- セキュリティモデル (12)
- リテラル (12)
- 正規表現 (12)
検索結果
先頭5件
-
Symbol (38048.0)
-
シンボルを表すクラス。シンボルは任意の文字列と一対一に対応するオブジェクトです。
...です。
シンボルオブジェクトは以下のようなリテラルで得られます。
:symbol
:'symbol'
%s!symbol! # %記法
生成されたシンボルの一覧は Symbol.all_symbols で得られます。
一番目のリテラルでシンボルを表す場合、`:' の後に
は......用途
==== 実装
Rubyの内部実装では、メソッド名や変数名、定数名、クラス名など
の`名前'を整数で管理しています。これは名前を直接文字列として処理するよりも
速度面で有利だからです。そしてその整数をRubyのコード上......配がない
大抵のメソッドはシンボルの代わりに文字列を引数として渡すこともできるようになっています。
Symbol クラスのメソッドには、String クラスのメソッドと同名で似た働きをするものもあります。
==== GC
内部的に... -
Symbol
. all _ symbols -> [Symbol] (27231.0) -
定義済みの全てのシンボルオブジェクトの配列を返します。
...定義済みの全てのシンボルオブジェクトの配列を返します。
p Symbol.all_symbols #=> [:RUBY_PLATFORM, :RUBY_VERSION, ...]
リテラルで表記したシンボルのうち、コンパイル時に値が決まるものはその時に生成されます。
それ以外の式......def number
'make_3'
end
p Symbol.all_symbols.select{|sym|sym.to_s.include? 'make'}
#=> [:make_1, :make_2]
re = #確実に生成されるように代入操作を行う
:make_1,
:'make_2',
:"#{number}",
'make_4'.intern
p Symbol.all_symbols.select{|sym|sym.to_s.include? 'mak... -
Symbol
# casecmp(other) -> -1 | 0 | 1 | nil (21046.0) -
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
Symbol#casecmp? と違って大文字小文字の違いを無視するのは
Unicode 全体ではなく、A-Z/a-z だけです。
@......param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(:abcdef) #=> 0
:aBcDeF.casecmp(:abcdefg) #=> -1
:abcdef.casecmp(:ABCDEF) #=> 0
:"\u{e4 f6 fc}".casecmp(:"\u{c4 d6 dc}") #=> 1
//}
other がシンボルではな......い場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?... -
Symbol
# match?(regexp , pos = 0) -> bool (21042.0) -
regexp.match?(self, pos) と同じです。 regexp が文字列の場合は、正規表現にコンパイルします。 詳しくは Regexp#match? を参照してください。
...す。
詳しくは Regexp#match? を参照してください。
例:
:Ruby.match?(/R.../) # => true
:Ruby.match?('Ruby') # => true
:Ruby.match?('Ruby',1) # => false
:Ruby.match?('uby',1) # => true
:Ruby.match?(/P.../) # => false
$& # => nil
@see Regex... -
Symbol
# casecmp(other) -> -1 | 0 | 1 | nil (21040.0) -
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、 アルファベットの大文字小文字の違いを無視します。
...
Symbol#<=> と同様にシンボルに対応する文字列の順序を比較しますが、
アルファベットの大文字小文字の違いを無視します。
@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:aBcDeF.casecmp(:abcde) #=> 1
:aBcDeF.casecmp(......ボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp, Symbol#<=>, Symbol#casecmp?... -
Symbol
# casecmp?(other) -> bool | nil (21018.0) -
大文字小文字の違いを無視しシンボルを比較します。 シンボルが一致する場合には true を返し、一致しない場合には false を返します。
...true を返し、一致しない場合には false を返します。
@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
:abcdef.casecmp?(:abcde) #=> false
:aBcDeF.casecmp?(:abcdef) #=> true
:abcdef.casecmp?(:abcdefg) #=> false
:abcdef.casecmp?(:ABCDEF) #=......er がシンボルではない場合や、文字列のエンコーディングが非互換の場合は、nil を返します。
//emlist[][ruby]{
:foo.casecmp?("foo") #=> nil
"\u{e4 f6 fc}".encode("ISO-8859-1").to_sym.casecmp?(:"\u{c4 d6 dc}") #=> nil
//}
@see String#casecmp?, Symbol#casecmp... -
Symbol
# name -> String (21018.0) -
シンボルに対応する文字列を返します。
...シンボルに対応する文字列を返します。
Symbol#to_sと違って freeze された文字列を返します。
//emlist[][ruby]{
p :fred.name # => "fred"
p :fred.name.frozen? # => true
p :fred.to_s # => "fred"
p :fred.to_s.frozen? # => false
//}
@see Symbol#to_s... -
Symbol
# to _ proc -> Proc (21018.0) -
self に対応する Proc オブジェクトを返します。
...roc オブジェクトは lambda です。
//emlist[][ruby]{
:object_id.to_proc.lambda? # => true
//}
//emlist[明示的に呼ぶ例][ruby]{
:to_i.to_proc["ff", 16] # => 255 ← "ff".to_i(16)と同じ
//}
//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡... -
Symbol
# <=>(other) -> -1 | 0 | 1 | nil (21012.0) -
self と other のシンボルに対応する文字列を ASCII コード順で比較して、 self が小さい時には -1、等しい時には 0、大きい時には 1 を返します。
...er がシンボルではなく比較できない時には nil を返します。
@param other 比較対象のシンボルを指定します。
//emlist[][ruby]{
p :aaa <=> :xxx # => -1
p :aaa <=> :aaa # => 0
p :xxx <=> :aaa # => 1
p :foo <=> "foo" # => nil
//}
@see String#<=>, Symbol#casecmp... -
Symbol
# end _ with?(*suffixes) -> bool (21012.0) -
self の末尾が suffixes のいずれかであるとき true を返します。
...ます。
(self.to_s.end_with?と同じです。)
@param suffixes パターンを表す文字列 (のリスト)
@see Symbol#start_with?
@see String#end_with?
//emlist[][ruby]{
:hello.end_with?("ello") #=> true
# returns true if one of the +suffixes+ matches.
:hello.end_with?("hea... -
Symbol
# start _ with?(*prefixes) -> bool (21012.0) -
self の先頭が prefixes のいずれかであるとき true を返します。
....start_with?と同じです。)
@param prefixes パターンを表す文字列または正規表現 (のリスト)
@see Symbol#end_with?
@see String#start_with?
//emlist[][ruby]{
:hello.start_with?("hell") #=> true
:hello.start_with?(/H/i) #=> true
# returns true i... -
Symbol
# to _ proc -> Proc (21012.0) -
self に対応する Proc オブジェクトを返します。
...ッドを
残りの引数を渡して呼びだします。
//emlist[明示的に呼ぶ例][ruby]{
:to_i.to_proc["ff", 16] # => 255 ← "ff".to_i(16)と同じ
//}
//emlist[暗黙に呼ばれる例][ruby]{
# メソッドに & とともにシンボルを渡すと
# to_proc が呼ばれて Proc 化... -
json
/ add / symbol (6032.0) -
Symbol に JSON 形式の文字列に変換するメソッドや JSON 形式の文字列から Ruby のオブジェクトに変換するメソッドを定義します。
...Symbol に JSON 形式の文字列に変換するメソッドや JSON 形式の文字列から Ruby のオブジェクトに変換するメソッドを定義します。...