class Rpictogrify::Themes::Base
Attributes
ident[R]
mapping[R]
resource[R]
Public Class Methods
new()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 17 def initialize @ident = get_ident @mapping = parse_mapping @resource = parse_resource end
Public Instance Methods
colors()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 35 def colors mapping['colors'] end
height()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 27 def height view_box[3] end
shapes()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 31 def shapes mapping['shapes'] end
symbol(id)
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 39 def symbol(id) resource.at_xpath("//*[@id='#{id}']") end
width()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 23 def width view_box[2] end
Private Instance Methods
get_ident()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 45 def get_ident Rpictogrify::Inflector.underscore(self.class.name).split('/').last end
parse_mapping()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 49 def parse_mapping JSON.parse File.read(Rpictogrify.themes_assets_path.join(ident, 'mapping.json')) end
parse_resource()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 53 def parse_resource Nokogiri.XML File.read(Rpictogrify.themes_assets_path.join(ident, 'resource.svg')) end
view_box()
click to toggle source
# File lib/rpictogrify/themes/base.rb, line 57 def view_box @view_box ||= mapping['viewBox'].split(' ') end