Class: Admin::Base::Resource::FiltersBuilder
- Inherits:
-
Object
- Object
- Admin::Base::Resource::FiltersBuilder
- Defined in:
- lib/admin/base/resource.rb
Instance Attribute Summary collapse
-
#filters ⇒ Object
readonly
Returns the value of attribute filters.
Instance Method Summary collapse
- #filter(name, **options) ⇒ Object
-
#initialize ⇒ FiltersBuilder
constructor
A new instance of FiltersBuilder.
Constructor Details
#initialize ⇒ FiltersBuilder
Returns a new instance of FiltersBuilder.
318 319 320 |
# File 'lib/admin/base/resource.rb', line 318 def initialize @filters = [] end |
Instance Attribute Details
#filters ⇒ Object (readonly)
Returns the value of attribute filters.
316 317 318 |
# File 'lib/admin/base/resource.rb', line 316 def filters @filters end |
Instance Method Details
#filter(name, **options) ⇒ Object
322 323 324 325 326 327 328 329 330 331 332 333 |
# File 'lib/admin/base/resource.rb', line 322 def filter(name, **) = .key?(:options) ? [:options] : [:collection] @filters << FilterDefinition.new( name: name, type: [:type] || :text, label: [:label] || name.to_s.humanize, placeholder: [:placeholder], options: , field: [:field] || name, apply: [:apply] ) end |