Module: Listen::Compat::Wrapper

Defined in:
lib/listen/compat/wrapper.rb

Defined Under Namespace

Classes: Ancient, Common, Current, Old, Stale

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.listen_moduleObject



40
41
42
# File 'lib/listen/compat/wrapper.rb', line 40

def listen_module
  @listen_module ||= Listen
end

.wrapper_classObject

Returns the value of attribute wrapper_class.



38
39
40
# File 'lib/listen/compat/wrapper.rb', line 38

def wrapper_class
  @wrapper_class
end

Class Method Details

.create(version_string = nil) ⇒ Object

Returns a wrapper matching the listen version

Parameters:

  • version_string (defaults to: nil)

    overrides detection (e.g. for testing)



161
162
163
164
165
166
167
168
169
# File 'lib/listen/compat/wrapper.rb', line 161

def self.create(version_string = nil)
  return Wrapper.wrapper_class.new if Wrapper.wrapper_class

  version = Gem::Version.new(version_string || _detect_listen_version)

  [Ancient, Old, Stale, Current].each do |klass|
    return klass.new if version < klass.const_get('NEXT_VERSION')
  end
end