Class: SimpleForm::Wrappers::Root
- Defined in:
- lib/simple_form/wrappers/root.rb
Overview
‘Root` is the root wrapper for all components. It is special cased to always have a namespace and to add special html classes.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Attributes inherited from Many
#components, #defaults, #namespace
Instance Method Summary collapse
-
#find(name) ⇒ Object
Provide a fallback if name cannot be found.
-
#initialize(*args) ⇒ Root
constructor
A new instance of Root.
- #render(input) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Root
Returns a new instance of Root.
8 9 10 11 |
# File 'lib/simple_form/wrappers/root.rb', line 8 def initialize(*args) super(:wrapper, *args) @options = @defaults.except(:tag, :class, :error_class, :hint_class) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/simple_form/wrappers/root.rb', line 6 def @options end |
Instance Method Details
#find(name) ⇒ Object
Provide a fallback if name cannot be found.
19 20 21 |
# File 'lib/simple_form/wrappers/root.rb', line 19 def find(name) super || SimpleForm::Wrappers::Many.new(name, [name]) end |
#render(input) ⇒ Object
13 14 15 16 |
# File 'lib/simple_form/wrappers/root.rb', line 13 def render(input) input..reverse_merge!(@options) super end |