Sha256: 030073e0f00cecd4e4d9405de89fb4e474fc3e1925989f5f985d63dfb2b3d0ab

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 Bytes

Contents

require "octicons/version"
require "octicons/octicon"
require "nokogiri"

module Octicons
  OCTICONS_SVG_PATH = File.join(File.dirname(__FILE__), "svg/*.svg")

  OCTICON_SYMBOLS = {}
  Dir[OCTICONS_SVG_PATH].each do |svg_path|
    id = File.basename(svg_path, ".svg")
    svg = Nokogiri::XML(File.read(svg_path))
    OCTICON_SYMBOLS[id] = {
      :path => "<path d=\"#{svg.css("path").first["d"]}\"></path>",
      :height => svg.css("svg").first["height"].to_i,
      :width => svg.css("svg").first["width"].to_i
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
octicons-1.1.0 lib/octicons.rb
octicons-1.0.0 lib/octicons.rb