Class: Moticons::Icon
- Inherits:
-
Object
- Object
- Moticons::Icon
- Defined in:
- lib/moticons/icon.rb
Constant Summary collapse
- COLLECTION_CLASSES =
{ awesome: :FAKFontAwesome, foundation: :FAKFoundationIcons, ion: :FAKIonIcons, zocial: :FAKZocial, octicon: :FAKOcticons, material: :FAKMaterialIcons }
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(collection, name = nil, options = {}) ⇒ Icon
constructor
A new instance of Icon.
- #to_image ⇒ Object
- #to_string ⇒ Object
Constructor Details
#initialize(collection, name = nil, options = {}) ⇒ Icon
Returns a new instance of Icon.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/moticons/icon.rb', line 14 def initialize(collection, name = nil, = {}) if name.is_a?(Hash) = name; name = nil end if name.nil? collection, name = collection.split('_', 2) end @collection = collection.to_sym @name = camelize(name).to_sym @size = .fetch(:size, 42) @color = .fetch(:color, UIColor.blackColor) create_instance end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
12 13 14 |
# File 'lib/moticons/icon.rb', line 12 def collection @collection end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
12 13 14 |
# File 'lib/moticons/icon.rb', line 12 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/moticons/icon.rb', line 12 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
12 13 14 |
# File 'lib/moticons/icon.rb', line 12 def size @size end |
Instance Method Details
#to_image ⇒ Object
29 30 31 |
# File 'lib/moticons/icon.rb', line 29 def to_image @instance.imageWithSize(CGSizeMake(size, size)) end |
#to_string ⇒ Object
33 34 35 |
# File 'lib/moticons/icon.rb', line 33 def to_string @instance.attributedString end |