Class: PoeRails::CheatSheetController

Inherits:
ApplicationController show all
Defined in:
app/controllers/poe_rails/cheat_sheet_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



7
8
9
10
11
12
13
14
# File 'app/controllers/poe_rails/cheat_sheet_controller.rb', line 7

def index
  @poe = POE.new
  @index = @poe.instance_variable_get("@index")
  @path = '/assets/poe/png64/'

  set_categories
  set_divided_emojis
end

#set_categoriesObject



16
17
18
19
20
21
# File 'app/controllers/poe_rails/cheat_sheet_controller.rb', line 16

def set_categories
  @categories = Array.new
  @index.each do |item|
    @categories << item['category'] if !@categories.include?(item['category'])
  end
end

#set_divided_emojisObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/controllers/poe_rails/cheat_sheet_controller.rb', line 23

def set_divided_emojis
  @divided_emojis = Array.new
  @categories.each do |category|
    emojis = Array.new
    @index.each do |emoji|
      if category == emoji['category']
        emojis << emoji
      end
    end
    @divided_emojis << emojis
  end
end