るりまサーチ

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

別のキーワード

  1. _builtin <
  2. bigdecimal <
  3. float <
  4. module <
  5. complex <

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

pp (38132.0)

オブジェクトなどを見やすく出力するためのライブラリです。

...このライブラリを require すると Kernel.#pp が定義されます。
Kernel.#p のかわりに Kernel.#pp を使うことにより、
適切にインデントと改行された分かりやすい出力を得ることが出来ます。
pp
ライブラリは、ユーザがあたらしく定...
...ので、Kernel.#pp を使う上で余計な作業をする
必要はありません。

=== どちらが読みやすいでしょうか?

p による pretty-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x...
...tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @tail=0, @buf=[#<PrettyPrint::Text:0x81a0b30 @tail=2, @wi
dth=1, @text="[">, #<PrettyPrint::Group:0x81a0a68 @group=2, @tail=1, @buf=[#<Pre
ttyPrint::Text:0x81a09f0 @tail=1, @width=1, @text="1">], @singleline_width=1>, #
<
PrettyPrint::Te...
...などを見やすく出力するためのライブラリです。

pp
ライブラリは、ユーザがあたらしく定義したクラスに対しても見やすい表示を
するように作られていますので、Kernel.#pp を使う上で余計な作業をする
必要はありません。...
...い出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c98 @group=0, @tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @tail=0, @buf=[#<PrettyPrint::Text:0x81a0b30 @tail=2, @wi
dth=1, @text="[">, #<PrettyPrint::Grou...
...@buf=[#<Pre
ttyPrint::Text:0x81a09f0 @tail=1, @width=1, @text="1">], @singleline_width=1>, #
<
PrettyPrint::Text:0x81a0a7c @tail=0, @width=1, @text=",">, #<PrettyPrint::Break
able:0x81a0a2c @group=2, @gensace=#<Proc:0x81a0cc0>, @newline="\n", @indent=1, @
tail=2, @sep=" ", @width=1>, #<Pretty...

OpenSSL::BN#<<(other) -> OpenSSL::BN (6112.0)

自身を other ビット左シフトした値を返します。

...自身を other ビット左シフトした値を返します。

//emlist[][ruby]{
bn = 1.to_bn
pp
bn << 1 # => #<OpenSSL::BN 2>
pp
bn # => #<OpenSSL::BN 1>
//}

@param other シフトするビット数
@raise OpenSSL::BNError 計算時エラー
@see OpenSSL::BN#lshift!...

REXML::SAX2Listener#start_prefix_mapping(prefix, uri) -> () (6112.0)

名前空間の接頭辞(prefix)が導入されたときに呼び出される コールバックメソッドです。

...ようなXMLを処理
<
a xmlns:foo="http://foo.example.org/">
<
foo:b />
<
/a>
すると
start_prefix_mapping("foo", "http://foo.example.org/")
start_element(nil, "a", "a", {"xmlns:foo" => "http://foo.example.org/"})
:
end_element(nil, "a", "a")
end_prefix_mapping("foo")
の順で...
...呼びだされます。つまり名前空間を導入した要素の start_element の前に
start_prefix_mapping が呼びだされます。

@param prefix 接頭辞の文字列が渡されます
@param uri 接頭辞に対応する URI 文字列が渡されます...

Kernel#try_cpp(src, opt = "", *opts) -> bool (6106.0)

C プログラムのソースコード src をプリプロセスします。

...C プログラムのソースコード src をプリプロセスします。

$CPPFLAGS, $CFLAGS の値もプリプロセッサにコマンドライン引数
として渡します。

このメソッドはヘッダファイルの存在チェックなどに使用します。

@param src C プログ...
...イン引数として渡す値を指定します。

@return 問題なくプリプロセスできたら true を返します。
プリプロセスに失敗したら false を返します。

例:

require 'mkmf'
if try_cpp("#include <stdio.h>")
$stderr.puts "stdio.h exists"
end...

Kernel#try_cpp(src, opt = "", *opts) { ... } -> bool (6106.0)

C プログラムのソースコード src をプリプロセスします。

...C プログラムのソースコード src をプリプロセスします。

$CPPFLAGS, $CFLAGS の値もプリプロセッサにコマンドライン引数
として渡します。

このメソッドはヘッダファイルの存在チェックなどに使用します。

@param src C プログ...
...イン引数として渡す値を指定します。

@return 問題なくプリプロセスできたら true を返します。
プリプロセスに失敗したら false を返します。

例:

require 'mkmf'
if try_cpp("#include <stdio.h>")
$stderr.puts "stdio.h exists"
end...

絞り込み条件を変える

Method#<<(callable) -> Proc (6106.0)

self と引数を合成した Proc を返します。

...thod(:f) << method(:g)).call(3) # => 36
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = method(:pp) << WordScanner << File.me...
...thod(:read)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@see Proc#<<, Proc#>>...

Logger::Application (6006.0)

ユーザ定義のアプリケーションにログ機能を簡単に追加することができます。

...App < Application
def initialize(foo_app, application_specific, arguments)
super('FooApp') # Name of the application.
end

def run
...
log(WARN, 'warning', 'my_method1')
...
@log.error('my_method2') { 'Error!' }
...
end
end

status = FooApp...
....new(....).start

=== 注意

このクラスは 2.2.0 で gem ライブラリとして切り離されました。2.2.0
以降ではそちらを利用してください。

* https://rubygems.org/gems/logger-application...

Ripper::Filter (3006.0)

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

...][ruby]{
require '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.escapeHTML(tok)}]
end

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

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

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

debug (156.0)

Ruby デバッガです。Ruby スクリプトのソースコードデバッグに使用します。

...す。

ここに挙げたもの以外を入力した場合、その入力を ruby の式として評価します。

: break
: break [<file>:]<position>|<class>:<method>
ブレークポイントを設定します。引数を省略した場合設定したブレークポ
イントを表示し...
...略形は b です。

: catch <an Exception>
例外が発生した時にデバッガを停止させるキャッチポイントを設定します。
引数を省略した場合設定したキャッチポイントを表示します。

発生した例外が <an Exception> のサブクラ...
...ます。

: thread <nnn>
: thread sw[itch] <nnn>
実行するスレッドを <nnn> に切替えます。

: thread stop <nnn>
スレッド <nnn> を停止します。

: thread resume <nnn>
スレッド <nnn> を再開します。

: pp <expression>
ruby の式 <expression> の結...

CGI::HtmlExtension#form(method = "post", action = nil, enctype = "application/x-www-form-urlencoded") -> String (119.0)

form 要素を生成します。 ブロックを与えると、ブロックを評価した結果が内容になります。

...デフォルトは "application/x-www-form-urlencoded" です。

例:
form{ "string" }
# <FORM METHOD="post" ENCTYPE="application/x-www-form-urlencoded">string</FORM>

form("get"){ "string" }
# <FORM METHOD="get" ENCTYPE="application/x-www-form-urlencoded">string</FORM>

form("get", "...
...url"){ "string" }
# <FORM METHOD="get" ACTION="url" ENCTYPE="application/x-www-form-urlencoded">string</FORM>...

絞り込み条件を変える

<< 1 2 > >>