Method: File.neverblock

Defined in:
lib/neverblock/io/file.rb

.neverblock(*methods) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/neverblock/io/file.rb', line 10

def self.neverblock(*methods)
  methods.each do |method|  
    class_eval %{
      def #{method}(*args)
        return rb_#{method}(*args) unless NB.neverblocking?
        NB.defer(self, :#{method}, args)
      end
    }
  end
end