Class: Funktional::ShouldNotBlock

Inherits:
Object
  • Object
show all
Defined in:
lib/funktional/context/should_not_block.rb

Class Method Summary collapse

Class Method Details

.build(options, context, &blk) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/funktional/context/should_not_block.rb', line 4

def self.build(options, context, &blk)
  
  if options.is_a? Symbol and options.eql? :send_email
    return ShouldNotSendEmailBlock.new(context)
  end
  
  case options.keys.first
    when :create
      ShouldNotCreateBlock.new(options[:create], context)
    when :delete
      ShouldNotDeleteBlock.new(options[:delete], context)
    else
      raise "Unknown assertion [should_not #{options.inspect}]"
  end
end