Sha256: 2f001255c4c6bf0d1e019c16edfe3cc410a42db4d7113590cbde5d036007325e
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# Cognitive Distance [](http://travis-ci.org/iande/cognitive_distance) ## Installing Not yet. ## Usage ### Measure the number of modules "hopped" by a method call class Mine def my_method Yours.new.your_method end end class Yours def initialize end def your_method end end CognitiveDistance::Measurements.measure_module_hops Mine.new, :my_method # => 2 CognitiveDistance::Measurements.measure_distinct_module_hopes Mine.new, :my_method # => 1 The module hops are: 1. Initializing the newly instantiated `Yours` object (`Yours#initialize`) 2. Calling `your_method` on the new instance There is only 1 distinct module hop because `my_method => Yours#initialize` and `my_method => Yours#your_method` cross the same boundary. At this time, only Ruby code is traced, so if `Yours` did not define an `initialize` method, both hop counts would be 1. *Brief Aside*: tracing `c-call` events changes nothing in this case, as no instance methods of the `Yours` instance are invoked until `#your_method` is called. ## License Let's go with Apache 2.0, I've been using it pretty frequently.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cognitive_distance-0.0.1.pre | README.md |