Class: MegaBar::BlockFilter
- Inherits:
-
Object
- Object
- MegaBar::BlockFilter
- Defined in:
- lib/mega_bar/block_filter.rb
Instance Method Summary collapse
- #filter ⇒ Object
-
#initialize(layout_section, rout, page_info) ⇒ BlockFilter
constructor
A new instance of BlockFilter.
Constructor Details
#initialize(layout_section, rout, page_info) ⇒ BlockFilter
Returns a new instance of BlockFilter.
3 4 5 6 7 |
# File 'lib/mega_bar/block_filter.rb', line 3 def initialize(layout_section, rout, page_info) @layout_section = layout_section @rout = rout @page_info = page_info end |
Instance Method Details
#filter ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/mega_bar/block_filter.rb', line 9 def filter blocks = base_blocks return blocks unless @layout_section.rules.present? case @layout_section.rules when "specific" filter_specific_blocks(blocks) when "chosen" filter_chosen_blocks(blocks) else blocks end end |