Skip to content

Custom policies for missing components #115

@yurifrl

Description

@yurifrl

Curly could have a option to not throw a error, a idea is to behave like i18n, i did a work around this:

# Curly Component
module Curly
  ComponentCompiler.class_eval do
    def initialize(presenter_class, component, type: nil)
      unless presenter_class.component_available?(component.name)
        component = Curly::Parser::Component.new('custom_error', nil, {'tag' => 'custom_error'})
      end
      @presenter_class, @component, @type = presenter_class, component, type
    end
  end
end
# Curly Presenter
def custom_error(tag: nil)
    "####{tag}###"
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions