Class: DMatch::Pred

Inherits:
Object show all
Includes:
Predicated
Defined in:
lib/destructure/types.rb

Instance Method Summary collapse

Methods included from Predicated

#test

Constructor Details

#initialize(pred_callable = nil, &pred_block) ⇒ Pred

Returns a new instance of Pred.



72
73
74
75
# File 'lib/destructure/types.rb', line 72

def initialize(pred_callable=nil, &pred_block)
  raise 'Cannot specify both a callable and a block' if pred_callable && pred_block
  self.pred = pred_callable || pred_block
end