Module: Tadpole::Filters::ClassMethods
- Defined in:
- lib/tadpole/filters.rb
Instance Method Summary collapse
- #before_run(meth = nil, &block) ⇒ Object
- #before_run_filters ⇒ Object
- #before_section(*args, &block) ⇒ Object (also: #before)
- #before_section_filters ⇒ Object
Instance Method Details
#before_run(meth = nil, &block) ⇒ Object
20 21 22 |
# File 'lib/tadpole/filters.rb', line 20 def before_run(meth = nil, &block) before_run_filters.push(meth ? meth : block) end |
#before_run_filters ⇒ Object
24 25 26 |
# File 'lib/tadpole/filters.rb', line 24 def before_run_filters @before_run_filters ||= [] end |
#before_section(*args, &block) ⇒ Object Also known as: before
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/tadpole/filters.rb', line 4 def before_section(*args, &block) args.push(block) if block if args.size == 1 before_section_filters.push [nil, args.first] elsif args.size == 2 before_section_filters.push(args) else raise ArgumentError, "before_section takes a section followed by a Proc/lambda or Symbol referencing the method name" end end |
#before_section_filters ⇒ Object
16 17 18 |
# File 'lib/tadpole/filters.rb', line 16 def before_section_filters @before_section_filters ||= [] end |