Class: Mensa::Filter
- Inherits:
-
Object
- Object
- Mensa::Filter
- Includes:
- ConfigReaders
- Defined in:
- app/tables/mensa/filter.rb
Instance Attribute Summary collapse
-
#column ⇒ Object
readonly
Returns the value of attribute column.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #collection ⇒ Object
-
#initialize(value, column:, config:, table:) ⇒ Filter
constructor
A new instance of Filter.
- #to_s ⇒ Object
Constructor Details
#initialize(value, column:, config:, table:) ⇒ Filter
Returns a new instance of Filter.
10 11 12 13 14 15 |
# File 'app/tables/mensa/filter.rb', line 10 def initialize(value, column:, config:, table:) @value = value @column = column @config = config @table = table end |
Instance Attribute Details
#column ⇒ Object (readonly)
Returns the value of attribute column.
6 7 8 |
# File 'app/tables/mensa/filter.rb', line 6 def column @column end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'app/tables/mensa/filter.rb', line 6 def config @config end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
6 7 8 |
# File 'app/tables/mensa/filter.rb', line 6 def table @table end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'app/tables/mensa/filter.rb', line 6 def value @value end |
Instance Method Details
#collection ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/tables/mensa/filter.rb', line 17 def collection return unless config&.key?(:collection) if config[:collection].is_a? Proc table.original_view_context.instance_exec(&config[:collection]) else config[:collection] end end |
#to_s ⇒ Object
27 28 29 |
# File 'app/tables/mensa/filter.rb', line 27 def to_s "#{column.human_name}: #{value}" end |