Class: Noft::Model::Icon
- Inherits:
-
Object
- Object
- Noft::Model::Icon
- Defined in:
- lib/noft/model.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#display_string ⇒ Object
A human readable name for icon.
-
#unicode ⇒ Object
The unicode that it was assigned inside the font.
Instance Method Summary collapse
-
#aliases ⇒ Object
Alternative aliases under which this icon may be known.
-
#categories ⇒ Object
Categories which this Icon exists.
- #read_from(data) ⇒ Object
- #to_h ⇒ Object
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description.
93 94 95 |
# File 'lib/noft/model.rb', line 93 def description @description end |
#display_string ⇒ Object
A human readable name for icon
92 93 94 |
# File 'lib/noft/model.rb', line 92 def display_string @display_string end |
#unicode ⇒ Object
The unicode that it was assigned inside the font.
96 97 98 |
# File 'lib/noft/model.rb', line 96 def unicode @unicode end |
Instance Method Details
#aliases ⇒ Object
Alternative aliases under which this icon may be known.
104 105 106 |
# File 'lib/noft/model.rb', line 104 def aliases @aliases ||= [] end |
#categories ⇒ Object
Categories which this Icon exists. Useful when displaying an icon sheet.
99 100 101 |
# File 'lib/noft/model.rb', line 99 def categories @categories ||= [] end |
#read_from(data) ⇒ Object
108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/noft/model.rb', line 108 def read_from(data) self.display_string = data['displayString'] if data['displayString'] self.description = data['description'] if data['description'] self.unicode = data['unicode'] if data['unicode'] data['aliases'].each do |a| self.aliases << a end if data['aliases'] data['categories'].each do |c| self.categories << c end if data['categories'] end |
#to_h ⇒ Object
120 121 122 123 124 125 126 127 128 129 |
# File 'lib/noft/model.rb', line 120 def to_h data = {} data[:displayString] = self.display_string if self.display_string data[:description] = self.description if self.description data[:aliases] = self.aliases unless self.aliases.empty? data[:categories] = self.categories unless self.categories.empty? data[:unicode] = self.unicode if self.unicode data end |