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.7.3 app/helpers/extface/devices_helper.rb
extface-0.7.2 app/helpers/extface/devices_helper.rb
extface-0.7.1 app/helpers/extface/devices_helper.rb
extface-0.7.0 app/helpers/extface/devices_helper.rb
extface-0.6.9 app/helpers/extface/devices_helper.rb
extface-0.6.8 app/helpers/extface/devices_helper.rb
extface-0.6.7 app/helpers/extface/devices_helper.rb
extface-0.6.6 app/helpers/extface/devices_helper.rb
extface-0.6.5 app/helpers/extface/devices_helper.rb
extface-0.6.4 app/helpers/extface/devices_helper.rb
extface-0.6.3 app/helpers/extface/devices_helper.rb
extface-0.6.2 app/helpers/extface/devices_helper.rb
extface-0.6.1 app/helpers/extface/devices_helper.rb
extface-0.6.0 app/helpers/extface/devices_helper.rb
extface-0.5.9 app/helpers/extface/devices_helper.rb
extface-0.5.8 app/helpers/extface/devices_helper.rb
extface-0.5.7 app/helpers/extface/devices_helper.rb
extface-0.5.6 app/helpers/extface/devices_helper.rb
extface-0.5.5 app/helpers/extface/devices_helper.rb
extface-0.5.4b app/helpers/extface/devices_helper.rb