Sha256: 71c90d1813ca15972a875f13a1855570ae712b0ddee3ab769ca74ad28beac51b

Contents?: true

Size: 545 Bytes

Versions: 2

Compression:

Stored size: 545 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") }
      file_names = 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

2 entries across 2 versions & 1 rubygems

Version Path
job_notifier-0.1.1 lib/job_notifier/adapters.rb
job_notifier-0.1.0 lib/job_notifier/adapters.rb