Sha256: ca1f08cfae9b442e99df035818d650047ee8b8eaa140adb3067e00f059270700

Contents?: true

Size: 532 Bytes

Versions: 15

Compression:

Stored size: 532 Bytes

Contents

module JobNotifier
  module Adapters
    def names
      dir = Engine.root.join("app", "assets", "javascripts", "job_notifier")
      files = Dir.entries(dir).select { |file| file.ends_with?(".js") }
      files.map { |file| file[0..-4] }
    end

    def get_adapter_path(adapter_name)
      raise JobNotifier::Error::InvalidAdapter.new unless names.include?(adapter_name)
      Engine.root.join("app", "assets", "javascripts", "job_notifier", "#{adapter_name}.js")
    end

    module_function :names, :get_adapter_path
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
job_notifier-3.0.0 lib/job_notifier/adapters.rb
job_notifier-2.0.0 lib/job_notifier/adapters.rb
job_notifier-1.5.0 lib/job_notifier/adapters.rb
job_notifier-1.4.0 lib/job_notifier/adapters.rb
job_notifier-1.3.0 lib/job_notifier/adapters.rb
job_notifier-1.2.4 lib/job_notifier/adapters.rb
job_notifier-1.2.3 lib/job_notifier/adapters.rb
job_notifier-1.2.2 lib/job_notifier/adapters.rb
job_notifier-1.2.1 lib/job_notifier/adapters.rb
job_notifier-1.2.0 lib/job_notifier/adapters.rb
job_notifier-1.1.1 lib/job_notifier/adapters.rb
job_notifier-1.1.0 lib/job_notifier/adapters.rb
job_notifier-1.0.0 lib/job_notifier/adapters.rb
job_notifier-0.2.1 lib/job_notifier/adapters.rb
job_notifier-0.2.0 lib/job_notifier/adapters.rb