Class: Heroicons::Icon
- Inherits:
-
Object
- Object
- Heroicons::Icon
- Defined in:
- lib/heroicons/icon.rb
Constant Summary collapse
- VARIANTS =
%i[solid outline].freeze
- SIZES =
[20, 24].freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#variant ⇒ Object
readonly
Returns the value of attribute variant.
Instance Method Summary collapse
-
#initialize(name, variant:, size:, **options) ⇒ Icon
constructor
A new instance of Icon.
- #render ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/heroicons/icon.rb', line 6 def name @name end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
6 7 8 |
# File 'lib/heroicons/icon.rb', line 6 def size @size end |
#variant ⇒ Object (readonly)
Returns the value of attribute variant.
6 7 8 |
# File 'lib/heroicons/icon.rb', line 6 def variant @variant end |
Instance Method Details
#render ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/heroicons/icon.rb', line 15 def render return warning unless content.present? fragment = Nokogiri::HTML::DocumentFragment.parse(content) svg = fragment.at_css "svg" @options.each { |key, value| svg[key.to_s] = value } fragment end |