Sha256: 943c1a20b677adc1ef87bf705df5bbdcd0df960d0c2530e54866cc29fcb6885c
Contents?: true
Size: 726 Bytes
Versions: 2
Compression:
Stored size: 726 Bytes
Contents
module Vp module Pears class VpTheme < ::Pears::Provider::LocalFile class InvalidVpTheme < StandardError; end; 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) end end ::Pears::Provider::Builder.enable_provider VpTheme end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vp-themes-0.1.1 | lib/vp/pears/vp_theme.rb |
vp-themes-0.1.0 | lib/vp/pears/vp_theme.rb |