Module: MotionForm::FontIconMapper

Defined in:
lib/project/font_icon_mapper.rb

Class Method Summary collapse

Class Method Details

.call(icon) ⇒ Object



4
5
6
# File 'lib/project/font_icon_mapper.rb', line 4

def call(icon)
  unicode(icon).hex.chr(Encoding::UTF_8)
end

.mappingsObject



12
13
14
15
16
17
18
19
# File 'lib/project/font_icon_mapper.rb', line 12

def mappings
  @mappings ||= begin
    path = NSBundle.mainBundle.pathForResource('icons', ofType:'json')
    data = NSData.dataWithContentsOfFile(path)

    NSJSONSerialization.JSONObjectWithData(data, options: 0, error: nil)
  end
end

.unicode(icon) ⇒ Object



8
9
10
# File 'lib/project/font_icon_mapper.rb', line 8

def unicode(icon)
  mappings[icon] || ''
end