537件ヒット
[1-100件を表示]
(0.091秒)
別のキーワード
ライブラリ
- ビルトイン (177)
-
cgi
/ core (12) - date (12)
-
irb
/ cmd / help (12) -
irb
/ cmd / load (36) -
irb
/ context (48) - json (12)
- mkmf (12)
- pathname (12)
- prime (24)
- rake (24)
-
rexml
/ document (120) -
rubygems
/ gem _ path _ searcher (12) - uri (24)
クラス
-
ARGF
. class (12) - CGI (12)
- Date (12)
- Enumerator (24)
- Float (11)
-
Gem
:: GemPathSearcher (12) - IO (12)
-
IRB
:: Context (48) -
IRB
:: ExtendCommand :: Help (12) -
IRB
:: ExtendCommand :: Load (12) -
IRB
:: ExtendCommand :: Require (12) -
IRB
:: ExtendCommand :: Source (12) - Integer (24)
- Module (24)
- Object (12)
- Pathname (12)
-
Prime
:: EratosthenesGenerator (24) -
REXML
:: Child (12) -
REXML
:: DocType (12) -
REXML
:: Element (60) -
REXML
:: Text (36) -
Rake
:: Application (12) -
Rake
:: FileList (12) -
RubyVM
:: InstructionSequence (10) - String (48)
-
URI
:: MailTo (24)
モジュール
キーワード
-
add
_ loader (12) -
create
_ makefile (12) -
each
_ element _ with _ text (12) - execute (48)
- extend (12)
-
extend
_ object (12) - extended (12)
-
external
_ encoding (12) -
external
_ id (12) -
get
_ text (12) - header (12)
-
inplace
_ mode= (12) -
lib
_ dirs _ for (12) - next (48)
- next! (12)
-
next
_ element (12) -
next
_ float (11) -
next
_ sibling= (12) -
next
_ values (12) -
next
_ year (12) -
prompt
_ mode (12) -
prompt
_ mode= (12) -
sub
_ ext (12) - succ (36)
- succ! (12)
- text (12)
- text= (12)
-
to
_ binary (10) -
to
_ json (12) -
to
_ mailtext (12) -
to
_ rfc822text (12) -
to
_ s (12) -
use
_ readline (12) -
use
_ readline? (12) - value (12)
- value= (12)
検索結果
先頭5件
-
Rake
:: FileList # ext(newext = & # 39;& # 39;) -> Rake :: FileList (18236.0) -
各要素に String#ext を適用した新しい Rake::FileList を返します。
...各要素に String#ext を適用した新しい Rake::FileList を返します。
//emlist[][ruby]{
# Rakefile での記載例とする
IO.write("test1.rb", "test")
IO.write("test2.rb", "test")
task default: :test_rake_app
task :test_rake_app do
file_list = FileList.new("test1.rb", "test2.rb"......, "test3.rb")
file_list.ext(".erb") # => ["test1.erb", "test2.erb", "test3.erb"]
end
//}
@see String#ext... -
REXML
:: Element # each _ element _ with _ text(text = nil , max = 0 , name = nil) {|element| . . . } -> () (6207.0) -
テキストを子ノードとして 持つすべての子要素を引数としてブロックを呼び出します。
...テキストを子ノードとして
持つすべての子要素を引数としてブロックを呼び出します。
text を指定すると、テキストの内容が text であるもののみを対象とします。
maxを指定すると、対象となる子要素の先頭 max 個のみが対......。
@param text テキストの中身(文字列)
@param max ブロック呼出の対象とする子要素の最大個数
@param name xpath文字列
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new '<a><b>b</b><c>b</c><d>d</d><e/></a>'
doc.root.each_element_with_text {|e|p e}
#......>> <b> ... </>
# >> <c> ... </>
# >> <d> ... </>
doc.root.each_element_with_text('b'){|e|p e}
# >> <b> ... </>
# >> <c> ... </>
doc.root.each_element_with_text('b', 1){|e|p e}
# >> <b> ... </>
doc.root.each_element_with_text(nil, 0, 'd'){|e|p e}
# >> <d> ... </>
//}... -
REXML
:: Element # get _ text(path = nil) -> REXML :: Text | nil (6207.0) -
先頭のテキスト子ノードを返します。
...ext#value も参照してください。
path を渡した場合は、その XPath 文字列で指定される
テキストノードの文字列を返します。
テキストノードがない場合には nil を返します。
@param path XPath文字列
@see REXML::Element#text
//emlist[][ruby......]{
require 'rexml/document'
doc = REXML::Document.new "<p>some text <b>this is bold!</b> more text</p>"
# doc.root (<p> ... </p>) は2つのテキストノード("some text " と " more text"
# を持っているが、前者を返す
doc.root.get_text.value # => "some text "
//}... -
REXML
:: Element # text=(text) (6207.0) -
「先頭の」テキストノードを text で置き換えます。
...ノードを text で置き換えます。
テキストノードを1つ以上保持している場合はそのうち
最初のノードを置き換えます。
要素がテキストノードを保持していない場合は新たなテキストノードが追加されます。
text には文字......ext、nil のいずれかが指定できます。
REXML::Text オブジェクトを指定した場合には、それが設定され、
文字列を指定した場合には
REXML::Text.new(text, whitespace(), nil, raw())
で生成される Text オブジェクトが設定されます。
nil を指定......れます。
@param text 置き換え後のテキスト(文字列、REXML::Text, nil(削除))
//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new('<a><b/></a>')
doc.to_s # => "<a><b/></a>"
doc.root.text = "Foo"; doc.to_s # => "<a><b/>Foo</a>"
doc.root.text = "Bar"; doc.to_s # => "... -
Pathname
# sub _ ext(replace) -> Pathname (6144.0) -
拡張子を与えられた文字列で置き換えた Pathname オブジェクトを返します。
...定します。
//emlist[例][ruby]{
require "pathname"
Pathname('/usr/bin/shutdown').sub_ext('.rb') # => #<Pathname:/usr/bin/shutdown.rb>
Pathname('/home/user/test.txt').sub_ext('.pdf') # => #<Pathname:/home/user/test.pdf>
Pathname('/home/user/test').sub_ext('.pdf') # => #<Pathname:/......home/user/test.pdf>
Pathname('/home/user/test.').sub_ext('.pdf') # => #<Pathname:/home/user/test..pdf>
Pathname('/home/user/.test').sub_ext('.pdf') # => #<Pathname:/home/user/.test.pdf>
Pathname('/home/user/test.tar.gz').sub_ext('.xz') # => #<Pathname:/home/user/test.tar.xz>
//}... -
URI
:: MailTo # to _ mailtext -> String (6137.0) -
URI オブジェクトからメールテキスト文字列を生成します。
...:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Subject: subscribe
Cc: myaddr... -
URI
:: MailTo # to _ rfc822text -> String (6137.0) -
URI オブジェクトからメールテキスト文字列を生成します。
...:
require 'uri'
p mailto = URI.parse("mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr")
print mailto.to_mailtext
=> #<URI::MailTo:0x20104a0e URL:mailto:ruby-list@ruby-lang.org?subject=subscribe&cc=myaddr>
To: ruby-list@ruby-lang.org
Subject: subscribe
Cc: myaddr... -
String
# next -> String (6131.0) -
self の「次の」文字列を返します。
...して計算されます。
//emlist[][ruby]{
p "aa".succ # => "ab"
p "88".succ.succ # => "90"
//}
"99" → "100", "AZZ" → "BAA" のような繰り上げも行われます。
このとき負符号などは考慮されません。
//emlist[][ruby]{
p "99".succ # => "100"
p "ZZ".succ......なり、残りは保存されます。
//emlist[][ruby]{
p "1.9.9".succ # => # "2.0.0"
//}
逆に self がアルファベットや数字をまったく含まない場合は、
単純に文字コードを 1 増やします。
//emlist[][ruby]{
p ".".succ # => "/"
//}
さらに、self が空......お、succ と逆の動作をするメソッドはありません。
また、succ という名前の由来は successor です。
//emlist[例][ruby]{
p "aa".succ # => "ab"
# 繰り上がり
p "99".succ # => "100"
p "a9".succ # => "b0"
p "Az".succ # => "Ba"
p "zz".succ # => "aaa"
p "-9... -
Enumerator
# next -> object (6119.0) -
「次」のオブジェクトを返します。
...合は、
StopIteration 例外を発生します。このとき列挙状態は変化しません。
つまりもう一度 next を呼ぶと再び例外が発生します。
next メソッドによる外部列挙の状態は他のイテレータメソッドによる
内部列挙には影響を与え......とき
@see Enumerator#rewind
//emlist[例1][ruby]{
str = "xyz"
enum = str.each_byte
str.bytesize.times do
puts enum.next
end
# => 120
# 121
# 122
//}
//emlist[例2][ruby]{
str = "xyz"
enum = str.each_byte
begin
puts enum.next while true
rescue StopIteration
puts "iterati......121
# 122
# iteration reached at end
puts enum.next
#=> 再度 StopIteration 例外が発生
//}
//emlist[例3: Kernel.#loop は StopIteration を捕捉します。][ruby]{
str = "xyz"
enum = str.each_byte
loop do
puts enum.next
end
# => 120
# 121
# 122
//}...