56件ヒット
[1-56件を表示]
(0.027秒)
別のキーワード
キーワード
- coverage (8)
- debug (12)
- irb (12)
-
irb
/ completion (12) - rdoc (12)
検索結果
先頭5件
-
debug (55.0)
-
Ruby デバッガです。Ruby スクリプトのソースコードデバッグに使用します。
...ithub.com/ruby/elisp にあるので、活用してください。
=== 使い方
$ ruby -rdebug foo.rb
または、Emacs から
M-x load-library rubydb3x.el
M-x rubydb
=== デバッグコマンド
以下は、デバッガで使用できるコマンド名とその用法の一覧です......挙げたもの以外を入力した場合、その入力を ruby の式として評価します。
: break
: break [<file>:]<position>|<class>:<method>
ブレークポイントを設定します。引数を省略した場合設定したブレークポ
イントを表示します。......tance] <object>
: var c[onst] <object>
それぞれ、グローバル変数、ローカル変数、オブジェクト<object>の
インスタンス変数、<object>の定数を表示します。
このコマンドの省略形は v です。
: method i[nstance] <object>
: method <class|... -
irb (31.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と同じ
-I ruby -I と同じ
-U ruby -U と同じ
-E enc ruby -E と同じ
--ve......6:0> irb # サブ irb を起動
irb#1(main):001:0> x # x を表示
NameError: undefined local variable or method `x' for main:Object
from (irb#1):1:in `Kernel#binding'
起動時のインタプリタでローカル変数 x を定義しましたが、
「irb」で......irb の設定をまとめて設定することができます。
以下に例を示します。
$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc:0x00002a95fa3fd8@(irb):2>
irb(main):002:0> irb
>
=== irb の使用例
irb のいろいろな使用... -
rdoc (31.0)
-
RDoc は Ruby のドキュメント生成を行うためのライブラリです。rdoc という ドキュメント生成のためのコマンドも含んでいます。
...age and calculate the
# date-of-birth.
#--
# FIXME: fails if the birthday falls on
# February 29th
#++
# The DOB is returned as a Time object.
def get_dob(person)
...
====[a:list] リスト
リストは以下のような記号が付いたパラグラフです。
* '*' も......ategory: Utility Methods
#
# CGI escapes +text+
def convert_string text
CGI.escapeHTML text
end
//}
title を省略した場合は、:section: を指定しなかった場合と同じように扱
われます。
//emlist{
# :category:
#
# This method is in the defau......lt category
def some_method
# ...
end
//}
:section: とは異なり、以降のドキュメントには影響しません。直後の要素
のみに影響します。
: :call-seq:
デフォルトではメソッドの引数や yield の引数をパースして出力しますが、... -
coverage (25.0)
-
カバレッジを測定するためのライブラリです。
...5. ファイル内での終了行
6. ファイル内での終了列
==== methodsカバレッジモード
methodsカバレッジモードでは、各メソッドの実行回数を計測します。
//emlist[foo_method.rb][ruby]{
class Greeter
def greet
"welcome!"
end
end
def hello
"......}
//emlist[][ruby]{
require "coverage"
Coverage.start(methods: true)
load "foo_method.rb"
pp Coverage.result
# {"foo_method.rb"=>
# {:methods=>
# {[Object, :hello, 7, 0, 9, 3]=>1, [Greeter, :greet, 2, 2, 4, 5]=>1}}}
//}
キーの :methods が指すハッシュの各キーはメソッド(の......//emlist[][ruby]{
require "coverage"
Coverage.start(:all)
load "foo.rb"
pp Coverage.result
# {"foo.rb"=>
# {:lines=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil],
# :branches=>
# {[:if, 0, 6, 0, 10, 3]=>
# {[:then, 1, 7, 2, 7, 7]=>1, [:else, 2, 9, 2, 9, 7]=>0}},
# :methods=>{}}}
//}... -
irb
/ completion (25.0) -
irb の completion 機能を提供するライブラリです。
...instance_eval
include install_alias_method instance_of?
initialize install_aliases instance_variables
irb(main):001:0> inspect
"main"
irb(main):002:0> foo = Object.new
#<Object:0x4027146c>
"変数名." の後に [Tab] を押すと, そのオ......foo.protected_methods
foo.=== foo.hash foo.public_methods
foo.=~ foo.id foo.respond_to?
foo.__id__ foo.inspect foo.send
foo.__send__ foo.instance_eval foo.singleton_methods
foo.class......foo.to_a
foo.dup foo.kind_of? foo.to_s
foo.eql? foo.method foo.type
foo.equal? foo.methods foo.untaint
foo.extend foo.nil?
foo.freeze foo.private_methods...