Sha256: beac7271ee204982e6eeeadd70b266290386ea37c1e0a166ec2a810536136840

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

require 'sass-listen/adapter'
require 'sass-listen/adapter/base'
require 'sass-listen/adapter/config'

require 'forwardable'

# This class just aggregates configuration object to avoid Listener specs
# from exploding with huge test setup blocks
module SassListen
  class Backend
    def initialize(directories, queue, silencer, config)
      adapter_select_opts = config.adapter_select_options

      adapter_class = Adapter.select(adapter_select_opts)

      # Use default from adapter if possible
      @min_delay_between_events = config.min_delay_between_events
      @min_delay_between_events ||= adapter_class::DEFAULTS[:wait_for_delay]
      @min_delay_between_events ||= 0.1

      adapter_opts = config.adapter_instance_options(adapter_class)

      aconfig = Adapter::Config.new(directories, queue, silencer, adapter_opts)
      @adapter = adapter_class.new(aconfig)
    end

    def start
      adapter.start
    end

    def stop
      adapter.stop
    end

    def min_delay_between_events
      @min_delay_between_events
    end

    private

    attr_reader :adapter
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/sass-listen-4.0.0/lib/sass-listen/backend.rb
sass-listen-4.0.0 lib/sass-listen/backend.rb