Class: Wice::GridOutputBuffer
- Defined in:
- lib/grid_output_buffer.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#return_empty_strings_for_nonexistent_filters ⇒ Object
Returns the value of attribute return_empty_strings_for_nonexistent_filters.
-
#stubborn_output_mode ⇒ Object
Returns the value of attribute stubborn_output_mode.
Instance Method Summary collapse
- #add_filter(detach_with_id, filter_code) ⇒ Object
- #filter_for(detach_with_id) ⇒ Object (also: #[])
-
#initialize(*attrs) ⇒ GridOutputBuffer
constructor
A new instance of GridOutputBuffer.
- #to_s ⇒ Object
Methods included from StringExt
Constructor Details
#initialize(*attrs) ⇒ GridOutputBuffer
Returns a new instance of GridOutputBuffer.
14 15 16 17 18 19 |
# File 'lib/grid_output_buffer.rb', line 14 def initialize(*attrs) super(*attrs) @filters = HashWithIndifferentAccess.new @first_output = false @stubborn_output_mode = false end |
Instance Attribute Details
#return_empty_strings_for_nonexistent_filters ⇒ Object
Returns the value of attribute return_empty_strings_for_nonexistent_filters.
7 8 9 |
# File 'lib/grid_output_buffer.rb', line 7 def return_empty_strings_for_nonexistent_filters @return_empty_strings_for_nonexistent_filters end |
#stubborn_output_mode ⇒ Object
Returns the value of attribute stubborn_output_mode.
6 7 8 |
# File 'lib/grid_output_buffer.rb', line 6 def stubborn_output_mode @stubborn_output_mode end |
Instance Method Details
#add_filter(detach_with_id, filter_code) ⇒ Object
30 31 32 33 |
# File 'lib/grid_output_buffer.rb', line 30 def add_filter(detach_with_id, filter_code) raise WiceGridException.new("Detached ID #{detach_with_id} is already used!") if @filters.has_key? detach_with_id @filters[detach_with_id] = filter_code end |
#filter_for(detach_with_id) ⇒ Object Also known as: []
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/grid_output_buffer.rb', line 35 def filter_for detach_with_id unless @filters.has_key? detach_with_id if @return_empty_strings_for_nonexistent_filters return '' else raise WiceGridException.new("No filter with Detached ID '#{detach_with_id}'!") end end raise WiceGridException.new("Filter with Detached ID '#{detach_with_id}' has already been requested once! There cannot be two instances of the same filter on one page") if @filters[detach_with_id] == false res = @filters[detach_with_id] @filters[detach_with_id] = false return res end |
#to_s ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/grid_output_buffer.rb', line 21 def to_s if @first_output || ! @stubborn_output_mode super.html_safe_if_necessary else @first_output = true '' end end |