module Take class Project module Requirement class Base def self.default_action(&blk) if block_given? @_default_action = blk else @_default_action end end def initialize(type, data, project, &blk) @type = type @data = data @block = blk @project = project raise ArgumentError, "Unexpected block for requirement " \ "#{self.class}" unless expected_block? end def fills_requirement? block = @block || default_action block.call(@data, @project) end def expected_block? true end def default_action self.class.default_action end end end end end