Module: GrnMini::Util
- Defined in:
- lib/grn_mini/util.rb
Class Method Summary collapse
- .group_with_sort(table, column) ⇒ Object
- .html_snippet_from_selection_results(table, open_tag = '<strong>', close_tag = "</strong>") ⇒ Object
- .text_snippet_from_selection_results(table, open_tag = '<<', close_tag = ">>") ⇒ Object
Class Method Details
.group_with_sort(table, column) ⇒ Object
7 8 9 |
# File 'lib/grn_mini/util.rb', line 7 def group_with_sort(table, column) table.group(column).sort_by {|record| record.n_sub_records }.reverse end |
.html_snippet_from_selection_results(table, open_tag = '<strong>', close_tag = "</strong>") ⇒ Object
15 16 17 |
# File 'lib/grn_mini/util.rb', line 15 def html_snippet_from_selection_results(table, open_tag = '<strong>', close_tag = "</strong>") table.expression.snippet([[open_tag, close_tag]], {html_escape: true, normalize: true}) end |
.text_snippet_from_selection_results(table, open_tag = '<<', close_tag = ">>") ⇒ Object
11 12 13 |
# File 'lib/grn_mini/util.rb', line 11 def text_snippet_from_selection_results(table, open_tag = '<<', close_tag = ">>") table.expression.snippet([[open_tag, close_tag]], {normalize: true}) end |