48件ヒット
[1-48件を表示]
(0.059秒)
種類
- インスタンスメソッド (33)
- 文書 (15)
ライブラリ
- ビルトイン (33)
キーワード
-
NEWS for Ruby 3
. 0 . 0 (4) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
-
instance
_ method (11)
検索結果
先頭5件
-
String
# each _ char -> Enumerator (39120.0) -
文字列の各文字に対して繰り返します。
...文字列の各文字に対して繰り返します。
たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界
@see String#chars... -
String
# each _ char {|cstr| block } -> self (39120.0) -
文字列の各文字に対して繰り返します。
...文字列の各文字に対して繰り返します。
たとえば、
//emlist[][ruby]{
"hello世界".each_char {|c| print c, ' ' }
//}
は次のように出力されます。
h e l l o 世 界
@see String#chars... -
NEWS for Ruby 3
. 0 . 0 (270.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......* String#*
* String#capitalize
* String#center
* String#chomp
* String#chop
* String#delete
* String#delete_prefix
* String#delete_suffix
* String#downcase
* String#dump
* String#each_char
* String#each_grapheme_cluster
* String......and Net::HTTP#verify_hostname have been added to skip hostname verification. 16555
* Net::HTTP.get, Net::HTTP.get_response, and Net::HTTP.get_print can take the request headers as a Hash in the second argument when the first argument is a URI. 16686
* Net::SMTP
* Add SNI support.
*... -
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (54.0)
-
Rubyで使われる記号の意味(正規表現の複雑な記号は除く) ex q num per and or plus minus ast slash hat sq period comma langl rangl eq tilde dollar at under lbrarbra lbra2rbra2 lbra3rbra3 dq colon ac backslash semicolon
...: /xxx/ !~ yyy
正規表現のメソッド =~ の否定。マッチが失敗したらtrueを返します。
===[a:q] ?
: ?a
d:spec/literal#string。長さ 1 の文字列。
: def xx?
この場合の「?」はメソッド名の一部分です。
慣用的に、真偽値を返すタイプ......件式 式 .. 式
条件式中の範囲式は特別にフリップフロップのように働きます。
//emlist{
'1234543212345'.each_char { |n| print( (n == ?2)..(n == ?4) ? n : '_' ) } #=> _234___21234_
#"2"が出るまではfalse、"2"が出てから"4"が出るまではtrue、"4"......"a is 10"
//}
===[a:lbra2] [
===[a:rbra2] ]
: [1,"some",:ok]
配列のリテラル
: 'abcde'[1,2]
[]メソッドの実行
//emlist{
class String
def [](*a)
'(^^;'
end
end
p( 'abcde'[1,2] ) #=> "(^^;"
//}
: /xx[abc]/
正規表現の文字クラス指定。
===[a:lbra3... -
Module
# instance _ method(name) -> UnboundMethod (48.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
...Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#public_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello "; end......e() print "!\n"; end
def do_v() print "Dave"; end
Dispatcher = {
"a" => instance_method(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }...