Module: RailsDevelopmentBoost::Async::Reactor

Extended by:
Reactor
Included in:
Reactor
Defined in:
lib/rails_development_boost/async/reactor.rb

Overview

Not using Listen gem directly, because I don’t want to be storing/checking .rb files’ SHA contents and would like to rely on mtime values exclusively.

Defined Under Namespace

Classes: Base, Darwin, Linux, MissingNativeGem, Windows

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gem_load_errorObject (readonly)

Returns the value of attribute gem_load_error.



22
23
24
# File 'lib/rails_development_boost/async/reactor.rb', line 22

def gem_load_error
  @gem_load_error
end

Instance Method Details

#find_usable_implementationObject



34
35
36
37
38
39
# File 'lib/rails_development_boost/async/reactor.rb', line 34

def find_usable_implementation
  [Darwin, Linux, Windows].find(&:usable?)
rescue MissingNativeGem => e
  @gem_load_error ||= e.message
  nil
end

#getObject



24
25
26
27
28
# File 'lib/rails_development_boost/async/reactor.rb', line 24

def get
  if impl = implementation
    impl.new
  end
end

#implementationObject



30
31
32
# File 'lib/rails_development_boost/async/reactor.rb', line 30

def implementation
  defined?(@implementation) ? @implementation : (@implementation = find_usable_implementation)
end