Class: ExpressTemplates::Components::Configurable

Inherits:
Base
  • Object
show all
Includes:
ExpressTemplates::Components::Capabilities::Configurable
Defined in:
lib/express_templates/components/configurable.rb

Overview

Configurable components support configuration options supplied to the builder method. Supported options must be declared. All other options are passed along and converted to html attributes.

Example:

“‘ruby

class Pane < ExpressTemplates::Components::Configurable

has_option :title, "Displayed in the title area", required: true
has_option :status, "Displayed in the status area"

end

# Usage:

pane(title: “People”, status: “#peoplepeople.count people”)

“‘ruby

Options specified as required must be supplied.

Default values may be supplied for options with a default: keyword. The value may be a proc. Useful for instances where you want a different value every time.

Options may be passed as html attributes with attribute: true

Direct Known Subclasses

Forms::FormComponent, Presenters::TreeFor

Constant Summary

Constants inherited from Base

Base::MAP

Method Summary

Methods included from ExpressTemplates::Components::Capabilities::Configurable

included

Methods inherited from Base

abstract_component, abstract_component?, before_build, #build, builder_method, builder_method_and_class, contains, descendants, has_attributes, inherited, #initialize, require_parent, required_parent, tag

Constructor Details

This class inherits a constructor from ExpressTemplates::Components::Base