Module: ZestuiLucideRails

Defined in:
lib/zestui-lucide-rails.rb,
lib/zestui-lucide-rails/railtie.rb,
lib/zestui-lucide-rails/version.rb,
lib/zestui-lucide-rails/rails_helper.rb,
lib/zestui-lucide-rails/icon_provider.rb

Defined Under Namespace

Modules: IconProvider, RailsHelper Classes: Railtie

Constant Summary collapse

DEFAULT_OPTIONS =

Extracted from options contained in svg tags from original/*.svg

{
  "aria-hidden" => "true",
  "width" => "24",
  "height" => "24",
  "viewBox" => "0 0 24 24",
  "fill" => "none",
  "stroke" => "currentColor",
  "stroke-width" => "2",
  "stroke-linecap" => "round",
  "stroke-linejoin" => "round"
}.freeze
GEM_ROOT =
Pathname.new(File.dirname(__FILE__)).join("..")
VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.default_optionsObject

Internal: Returns the overriden default options, or the builtin one in case no override occurred.



57
58
59
# File 'lib/zestui-lucide-rails.rb', line 57

def default_options
  @default_options || DEFAULT_OPTIONS
end

.default_options=(value) ⇒ Object

Public: Overrides default options for every svg generated by the library. See ZestuiLucideRails::DEFAULT_OPTIONS for reference.



51
52
53
# File 'lib/zestui-lucide-rails.rb', line 51

def default_options=(value)
  @default_options = value
end

.providerObject

Internal: Returns either the set provider, falling back to the default one.



45
46
47
# File 'lib/zestui-lucide-rails.rb', line 45

def provider
  @provider || :memory
end

.provider=(type) ⇒ Object

Public: Defines the default provider for icons. The library can either load icons from the filesystem as required, or use a memory cache for all icons, avoiding filesystem accesses for each required icon on the cost of a slightly extra memory usage.

type - Type of provider to use. Accepts either :memory (default), or

:filesystem

Returns nothing.



36
37
38
39
40
41
42
# File 'lib/zestui-lucide-rails.rb', line 36

def provider=(type)
  unless [:memory, :filesystem, nil].include? type
    raise ArgumentError, "Unknown provider #{type}, valid options are :memory, :filesystem"
  end

  @provider = type
end