a

Ruby code posted
created at 03 Sep 22:38

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
class HomeController < ApplicationController

  FEATURE_ICONS_DIRECTORY = File.join(::Rails.root, "public/img/feature-icons")

  def index
    # Find all the images in the "feature-icons" directory, strip off
    # the directory and extension, to just leave a list of icon names
    @feature_names =
      Dir.entries(File.join(FEATURE_ICONS_DIRECTORY)).
        reject { |f| ! f.end_with? ".png" }.
        map    { |f| f.split(".")[0] }.
        sort
  end
end
475 Bytes in 2 ms with coderay