Class: PhlexIcons::NameParser
- Inherits:
-
Object
- Object
- PhlexIcons::NameParser
- Defined in:
- lib/phlex-icons/name_parser.rb
Instance Attribute Summary collapse
-
#icon_name ⇒ Object
readonly
Returns the value of attribute icon_name.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#pack_name ⇒ Object
readonly
Returns the value of attribute pack_name.
-
#variant_name ⇒ Object
readonly
Returns the value of attribute variant_name.
Instance Method Summary collapse
-
#initialize(identifier) ⇒ NameParser
constructor
Initializes the parser with the full icon identifier string (e.g., “hero/arrow-right:solid”).
Constructor Details
#initialize(identifier) ⇒ NameParser
Initializes the parser with the full icon identifier string (e.g., “hero/arrow-right:solid”). Parses the string into pack, icon, and variant components. Determines and validates the corresponding icon component class.
13 14 15 16 17 |
# File 'lib/phlex-icons/name_parser.rb', line 13 def initialize(identifier) @identifier = identifier.to_s @pack_name, @icon_name, @variant_name = parse(@identifier) @klass = find_icon_class(@pack_name, @icon_name) end |
Instance Attribute Details
#icon_name ⇒ Object (readonly)
Returns the value of attribute icon_name.
5 6 7 |
# File 'lib/phlex-icons/name_parser.rb', line 5 def icon_name @icon_name end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/phlex-icons/name_parser.rb', line 5 def identifier @identifier end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
5 6 7 |
# File 'lib/phlex-icons/name_parser.rb', line 5 def klass @klass end |
#pack_name ⇒ Object (readonly)
Returns the value of attribute pack_name.
5 6 7 |
# File 'lib/phlex-icons/name_parser.rb', line 5 def pack_name @pack_name end |
#variant_name ⇒ Object (readonly)
Returns the value of attribute variant_name.
5 6 7 |
# File 'lib/phlex-icons/name_parser.rb', line 5 def variant_name @variant_name end |