class Opswatch::IconPack

Public Class Methods

new(stack_name, icon_paths = nil) click to toggle source
# File lib/icon_pack.rb, line 7
def initialize(stack_name, icon_paths = nil)
  icon_paths = icon_paths || %w[hold negative off positive].map { |base_icon| [base_icon, "#{GEM_ROOT}/icons/#{base_icon}.png"] }.to_h
  @stack_name = stack_name
  @file_paths = generate_icons(icon_paths)
end

Public Instance Methods

fetch(key) click to toggle source
# File lib/icon_pack.rb, line 13
def fetch(key)
  @file_paths[key].path
end

Private Instance Methods

generate_icons(icon_paths) click to toggle source
# File lib/icon_pack.rb, line 19
def generate_icons(icon_paths)
  icon_paths.map { |name, path| [name, Icon.new(@stack_name, path)] }.to_h
end