1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00
heartcombo--simple_form/test/support/discovery_inputs.rb
Dillon Welch cac943e891 Add frozen_string_literal in all .rb files
I noticed these files all had strings such as "", "  ", "_" that were
allocated each time some common methods were called, over 1000x on a
page in my app. This comment freezes all of these strings such that
they're only allocated once, saving many KB of memory allocation.
2017-11-27 17:06:18 -08:00

58 lines
1.2 KiB
Ruby

# frozen_string_literal: true
class StringInput < SimpleForm::Inputs::StringInput
def input(wrapper_options = nil)
"<section>#{super}</section>".html_safe
end
end
class NumericInput < SimpleForm::Inputs::NumericInput
def input(wrapper_options = nil)
"<section>#{super}</section>".html_safe
end
end
class CustomizedInput < SimpleForm::Inputs::StringInput
def input(wrapper_options = nil)
"<section>#{super}</section>".html_safe
end
def input_method
:text_field
end
end
class DeprecatedInput < SimpleForm::Inputs::StringInput
def input
"<section>#{super}</section>".html_safe
end
def input_method
:text_field
end
end
class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
def input_html_classes
super.push('chosen')
end
end
module CustomInputs
class CustomizedInput < SimpleForm::Inputs::StringInput
def input_html_classes
super.push('customized-namespace-custom-input')
end
end
class PasswordInput < SimpleForm::Inputs::PasswordInput
def input_html_classes
super.push('password-custom-input')
end
end
class NumericInput < SimpleForm::Inputs::PasswordInput
def input_html_classes
super.push('numeric-custom-input')
end
end
end