Class: FA::Span

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

Overview

FontAwesome 5 (Pro) Helper for generating spans (counters and text)

Since:

  • 0.1.0

Constant Summary

Constants inherited from Base

Base::MODES, Base::STYLES

Instance Method Summary collapse

Methods inherited from Base

p, #safe

Constructor Details

#initialize(fa, text = '', options = {}) ⇒ Span

Creates a new Span instance

Parameters:

  • fa (Hash)

    The complete span configuration

  • fa (String)

    The span type to generate

  • test (String)

    The contents of the span

  • options (Hash) (defaults to: {})

    Additional configuration options

Since:

  • 0.1.0



12
13
14
15
16
17
18
19
20
# File 'lib/fa/span.rb', line 12

def initialize(fa, text = '', options = {})
  if fa.is_a?(Hash)
    set_options(fa[:type].to_sym, fa[:text], fa[:options])
  elsif fa.is_a?(String) || fa.is_a?(Symbol)
    set_options(fa.to_s, text, options)
  else
    raise ArgumentError, 'Unexpected argument type.'
  end
end

Instance Method Details

#rawObject

Outputs the formatted span directly.

Since:

  • 0.1.0



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

def raw
  parse_span(@type, @text, @options)
end