Sha256: 6ed88922fe4e4562b60e6cf5ba4d9814729321ccf2d4691e81094fa7d9de042f
Contents?: true
Size: 937 Bytes
Versions: 2
Compression:
Stored size: 937 Bytes
Contents
module FlexibleAccessibility class Utils def initialize @path = "#{::Rails.root}/app/controllers/" @controllers = {} end def get_controllers get_controllers_recursive(@path) end # All controller clases placed in :default scope def get_controllers_recursive(path) (Dir.new(path).entries - ["..", "."]).each do |entry| if File.directory?(path + entry) get_controllers_recursive(path + entry + '/') else parent_directory = File.dirname(path + entry).split(/\//).last container = parent_directory == "controllers" ? "default" : parent_directory @controllers[container.to_sym] = [] unless @controllers.has_key? container.to_sym @controllers[container.to_sym] << File.basename(path + entry, ".*") unless File.basename(path + entry, ".*") == "application_controller" end end @controllers end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
flexible_accessibility-0.3.1 | lib/flexible_accessibility/utils.rb |
flexible_accessibility-0.3.0 | lib/flexible_accessibility/utils.rb |