Module: Algorithm

Defined in:
lib/shellopts/ext/follow.rb

Defined Under Namespace

Classes: FollowEnumerator

Class Method Summary collapse

Class Method Details

.follow(object, method = nil, &block) ⇒ Object



15
16
17
18
19
# File 'lib/shellopts/ext/follow.rb', line 15

def follow(object, method = nil, &block)
  !method.nil? || block_given? or raise ArgumentError, "Needs either a method or a block"
  method.nil? == block_given? or raise ArgumentError, "Can't use both method and block"
  FollowEnumerator.new(object, method, &block)
end