Sha256: 073702d0d1a9e3dd943773a140d9f16e154efa023a7a8d4b62032c4107fe1e6e

Contents?: true

Size: 629 Bytes

Versions: 14

Compression:

Stored size: 629 Bytes

Contents

module Extface
  module DevicesHelper
    
    def subdrivers(object)
      [].tap do |drivers|
        object.subclasses.each do |s|
          drivers << s
          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
          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

14 entries across 14 versions & 1 rubygems

Version Path
extface-0.2.4 app/helpers/extface/devices_helper.rb
extface-0.2.3 app/helpers/extface/devices_helper.rb
extface-0.2.2 app/helpers/extface/devices_helper.rb
extface-0.2.1 app/helpers/extface/devices_helper.rb
extface-0.2.0 app/helpers/extface/devices_helper.rb
extface-0.1.9 app/helpers/extface/devices_helper.rb
extface-0.1.8 app/helpers/extface/devices_helper.rb
extface-0.1.7 app/helpers/extface/devices_helper.rb
extface-0.1.6 app/helpers/extface/devices_helper.rb
extface-0.1.5 app/helpers/extface/devices_helper.rb
extface-0.1.4 app/helpers/extface/devices_helper.rb
extface-0.1.3 app/helpers/extface/devices_helper.rb
extface-0.1.2 app/helpers/extface/devices_helper.rb
extface-0.1.1 app/helpers/extface/devices_helper.rb