るりまサーチ

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

別のキーワード

  1. rexml comment
  2. comment ==
  3. comment <=>
  4. comment clone

ライブラリ

キーワード

検索結果

REXML::Comment (6007.0)

XML コメントを表すクラス。

...クラス。

コメントとは <!-- と --> で挟まれたテキストです。

//emlist[][ruby]{
require 'rexml/document'
doc = REXML::Document.new(<<EOS)
<!-- xx -->
<root>
<!-- yy -->
text
<!-- zz -->
</root>
EOS

doc[0].string # => " xx "
doc.root[1].string # => " yy "
doc.root[3].string # =...

Ripper::Filter (19.0)

イベントドリブンスタイルで Ruby プログラムを加工するためのクラスです。

...e 'ripper'
require 'cgi'

class
Ruby2HTML < Ripper::Filter
def on_default(event, tok, f)
f << CGI.escapeHTML(tok)
end

def on_comment(tok, f)
f << %Q[<span class="comment">#{CGI.escapeHTML(tok)}</span>]
end

def on_tstring_beg(tok, f)
f << %Q[<span class="string">#{CGI.escapeHT...
...ML(tok)}]
end

def on_tstring_end(tok, f)
f << %Q[#{CGI.escapeHTML(tok)}</span>]
end
end

Ruby2HTML.new(ARGF).parse('')
//}

Ruby プログラムを解析して、Ripper::SCANNER_EVENTS にあるスキャナ
イベントを実行します。イベントはプログラムに書いた順番...