Sha256: fa7f432ee1183b7c9e89050be9f52ecda920cb7913ef6504920272ef773c484d
Contents?: true
Size: 724 Bytes
Versions: 2
Compression:
Stored size: 724 Bytes
Contents
require "octicons/version" require "octicons/octicon" require "nokogiri" require "json" module Octicons OCTICONS_SVG_PATH = File.join(File.dirname(__FILE__), "svg/*.svg") KEYWORDS = JSON.parse(File.read(File.join(File.dirname(__FILE__), "keywords.json"))) CODEPOINTS = JSON.parse(File.read(File.join(File.dirname(__FILE__), "codepoints.json"))) 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-2.1.0 | lib/octicons.rb |
octicons-2.0.0 | lib/octicons.rb |