项目作者: siman-man

项目描述 :
MethodCallTree is like tree command for method call stack.
高级语言: Ruby
项目地址: git://github.com/siman-man/method_call_tree.git
创建时间: 2017-12-28T13:40:25Z
项目社区:https://github.com/siman-man/method_call_tree

开源协议:MIT License

下载


Build Status

MethodCallTree

MethodCallTree is like tree command for method call stack.

Installation

  1. gem 'method_call_tree'

Usage

  1. require 'method_call_tree'
  2. class Foo
  3. def foo
  4. bar
  5. baz
  6. end
  7. def bar
  8. end
  9. def baz
  10. hoge
  11. end
  12. def hoge
  13. end
  14. end
  15. tree = MethodCallTree.create do
  16. Foo.new.foo
  17. end
  18. puts tree

result

  1. foo
  2. ├───── bar
  3. └───── baz
  4. └───── hoge

class option

  1. tree = MethodCallTree.create(class: true) do
  2. Foo.new.foo
  3. end

result

  1. Foo::foo
  2. ├───── Foo::bar
  3. └───── Foo::baz
  4. └───── Foo::hoge

args options enable

  1. require 'method_call_tree'
  2. def fibonacci(a = 1, b = 0)
  3. return if a > 10
  4. fibonacci(a + b, a)
  5. end
  6. tree = MethodCallTree.create(args: true) do
  7. fibonacci
  8. end
  9. puts tree

result

  1. fibonacci(a = 1, b = 0)
  2. └───── fibonacci(a = 1, b = 1)
  3. └───── fibonacci(a = 2, b = 1)
  4. └───── fibonacci(a = 3, b = 2)
  5. └───── fibonacci(a = 5, b = 3)
  6. └───── fibonacci(a = 8, b = 5)
  7. └───── fibonacci(a = 13, b = 8)

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the MethodCallTree project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.