Sha256: 87380108ad4e045a58ec571d7bdb99b981197ce31e40cad3033189f30a6f4b59
Contents?: true
Size: 872 Bytes
Versions: 33
Compression:
Stored size: 872 Bytes
Contents
module Vp module Pears class VpTheme < ::Pears::Provider::LocalFile class InvalidVpTheme < StandardError; end; # Get all THEMES = Dir[ "#{__FILE__}".split('/') .slice(0..-4) .join('/') .+('/themes/*') ] MAP = Hash[ THEMES.map do |fil| fil.split('/') .last .delete_suffix('.yml') end.zip(THEMES) ].with_indifferent_access.freeze def initialize(name, on_failure: :raise) file = MAP[name&.downcase] raise InvalidVpTheme.new(name) unless file.present? super(file, on_failure: on_failure) rescue InvalidVpTheme => e if on_failure == :null @data = {} else raise e end end end ::Pears::Provider::Builder.enable_provider VpTheme end end
Version data entries
33 entries across 33 versions & 1 rubygems