Method: Lemon::Snapshot::Unit#initialize

Defined in:
lib/lemon/coverage/snapshot.rb

#initialize(target, method, props = {}) ⇒ Unit

Returns a new instance of Unit.



110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/lemon/coverage/snapshot.rb', line 110

def initialize(target, method, props={})
  @target    = target
  @method    = method.to_sym
  @singleton = props[:singleton] ? true : false
  @covered   = props[:covered]

  if @singleton
    @private   = @target.private_methods.find{ |m| m.to_sym == @method }
    @protected = @target.protected_methods.find{ |m| m.to_sym == @method }
  else
    @private   = @target.private_instance_methods.find{ |m| m.to_sym == @method }
    @protected = @target.protected_instance_methods.find{ |m| m.to_sym == @method }
  end
end