Sha256: a673e0c8cfb72d4aad9d242969f47bf42ab5cc18f90ab36e11d4017b7b776500

Contents?: true

Size: 677 Bytes

Versions: 61

Compression:

Stored size: 677 Bytes

Contents

module Extface
  module DevicesHelper
    
    def subdrivers(object)
      [].tap do |drivers|
        object.subclasses.each do |s|
          drivers << s unless s.abstract_class
          drivers << subdrivers(s) if s.subclasses.any?
        end
      end
    end
    
    def options_for_drivers
      Extface::Engine.eager_load! if Rails.env.development?
      [].tap do |drivers|
        Extface::Driver.subclasses.each do |s|
          drivers << s unless s.abstract_class
          drivers << subdrivers(s)
        end
      end.flatten.group_by{ |x| x::GROUP }.sort.collect{ |group, drivers| [group, drivers.collect{ |d| [d::NAME, d.to_s] }.sort ] }
    end
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
extface-0.5.4a app/helpers/extface/devices_helper.rb
extface-0.5.4 app/helpers/extface/devices_helper.rb
extface-0.5.3 app/helpers/extface/devices_helper.rb
extface-0.5.2 app/helpers/extface/devices_helper.rb
extface-0.5.1 app/helpers/extface/devices_helper.rb
extface-0.5.0 app/helpers/extface/devices_helper.rb
extface-0.4.9 app/helpers/extface/devices_helper.rb
extface-0.4.8 app/helpers/extface/devices_helper.rb
extface-0.4.7 app/helpers/extface/devices_helper.rb
extface-0.4.6k app/helpers/extface/devices_helper.rb
extface-0.4.6i app/helpers/extface/devices_helper.rb
extface-0.4.6h app/helpers/extface/devices_helper.rb
extface-0.4.6g app/helpers/extface/devices_helper.rb
extface-0.4.6f app/helpers/extface/devices_helper.rb
extface-0.4.6e app/helpers/extface/devices_helper.rb
extface-0.4.6d app/helpers/extface/devices_helper.rb
extface-0.4.6c app/helpers/extface/devices_helper.rb
extface-0.4.6b app/helpers/extface/devices_helper.rb
extface-0.4.6a app/helpers/extface/devices_helper.rb
extface-0.4.6 app/helpers/extface/devices_helper.rb