app/components/lookbook/code/component.rb in lookbook-1.3.4 vs app/components/lookbook/code/component.rb in lookbook-1.4.0
- old
+ new
@@ -1,7 +1,5 @@
-require "active_model"
-
module Lookbook
class Code::Component < Lookbook::BaseComponent
include Lookbook::OutputHelper
def initialize(
@@ -54,11 +52,11 @@
def is_dark?
@dark
end
def before_render
- @theme ||= (config.highlighter_options && config.highlighter_options[:theme]&.to_sym) || :github
- @dark ||= ::ActiveModel::Type::Boolean.new.cast((config.highlighter_options && config.highlighter_options[:dark]) || false)
+ @theme ||= Lookbook.config.highlighter_options.fetch(:theme, :github).to_sym
+ @dark ||= !!Lookbook.config.highlighter_options.fetch(:dark, false)
end
protected
def alpine_component