Class: CafeCar::Filter::FormBuilder
- Inherits:
-
Object
- Object
- CafeCar::Filter::FormBuilder
- Defined in:
- lib/cafe_car/filter/form_builder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #clean(method) ⇒ Object
- #field_name(*methods, multiple: false, index: @options[:index]) ⇒ Object
- #info(method) ⇒ Object
Class Method Details
.dotted_name(method) ⇒ Object
3 4 5 6 7 |
# File 'lib/cafe_car/filter/form_builder.rb', line 3 def self.dotted_name(method) define_method method do |key, *args, **opts, &block| super(key, *args, name: field_name(key), **opts, &block) end end |
Instance Method Details
#clean(method) ⇒ Object
13 |
# File 'lib/cafe_car/filter/form_builder.rb', line 13 def clean(method) = method.to_s.sub(/^\W+|\W+$/, "") |
#field_name(*methods, multiple: false, index: @options[:index]) ⇒ Object
16 17 18 19 |
# File 'lib/cafe_car/filter/form_builder.rb', line 16 def field_name(*methods, multiple: false, index: @options[:index]) # TODO: handle multiple/index [ "", *methods ].join(".") end |
#info(method) ⇒ Object
14 |
# File 'lib/cafe_car/filter/form_builder.rb', line 14 def info(method) = super(clean(method)) |