Module: LucideRails

Defined in:
lib/lucide-rails.rb,
lib/lucide-rails/railtie.rb,
lib/lucide-rails/version.rb,
lib/lucide-rails/rails_helper.rb,
lib/lucide-rails/icon_provider.rb,
lib/lucide-rails/lucide_version.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"
}.with_indifferent_access.freeze
GEM_ROOT =
Pathname.new(File.dirname(__FILE__)).join("..")
VERSION =
"0.5.1"
LUCIDE_VERSION =
"0.417.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.



59
60
61
# File 'lib/lucide-rails.rb', line 59

def default_options
  @default_options || DEFAULT_OPTIONS
end

.default_options=(value) ⇒ Object

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



53
54
55
# File 'lib/lucide-rails.rb', line 53

def default_options=(value)
  @default_options = value
end

.providerObject

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



47
48
49
# File 'lib/lucide-rails.rb', line 47

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.



38
39
40
41
42
43
44
# File 'lib/lucide-rails.rb', line 38

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

  @provider = type
end