Class: FA::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/fa/base.rb

Overview

FontAwesome 6 (Pro) Helper core class for inheritance

Since:

  • 0.1.0

Direct Known Subclasses

Icon, Layer, Link, Span

Constant Summary collapse

STYLES =

Since:

  • 0.1.0

{
  nil => 's',
  solid: 's', regular: 'r', light: 'l', thin: 't',
  duotone: 'd', brands: 'b', kit_upload: 'k'
}.freeze
MODES =

Since:

  • 0.1.0

{
  nil => '',
  sharp: 's'
}.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.pObject

Shortcut for create and output safe

Since:

  • 0.1.0



29
30
31
# File 'lib/fa/base.rb', line 29

def self.p(...)
  new(...).safe
end

Instance Method Details

#rawObject

Outputs the formatted string directly.

Since:

  • 0.1.0



18
19
20
# File 'lib/fa/base.rb', line 18

def raw
  #
end

#safe(html = nil) ⇒ Object

Attempts to call ‘.html_safe` on the the output of `raw`, if available.

Since:

  • 0.1.0



23
24
25
26
# File 'lib/fa/base.rb', line 23

def safe(html = nil)
  output = html || raw
  output.respond_to?(:html_safe) ? output.html_safe : output
end