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.2.5 app/helpers/extface/devices_helper.rb