Module: RDBr::Web::ArrayValueHelpers
- Included in:
- Helpers
- Defined in:
- lib/rdbr/web/array_value_helpers.rb
Constant Summary collapse
- INLINE_ARRAY_ITEMS =
5- INLINE_ARRAY_CHARACTERS =
100
Instance Method Summary collapse
- #array_column?(column) ⇒ Boolean
- #deferred_array_value?(column, value) ⇒ Boolean
- #render_array_value(value) ⇒ Object
Instance Method Details
#array_column?(column) ⇒ Boolean
7 8 9 10 |
# File 'lib/rdbr/web/array_value_helpers.rb', line 7 def array_column?(column) logical_type = column.logical_type.to_s logical_type.start_with?('_') || column.sql_type.to_s.match?(/\[\](?:\[\])*\z/) end |
#deferred_array_value?(column, value) ⇒ Boolean
12 13 14 15 16 17 |
# File 'lib/rdbr/web/array_value_helpers.rb', line 12 def deferred_array_value?(column, value) return false unless array_column?(column) array_dimensions(value) > 1 || array_item_count(value) > INLINE_ARRAY_ITEMS || array_text(value).length > INLINE_ARRAY_CHARACTERS end |
#render_array_value(value) ⇒ Object
19 20 21 |
# File 'lib/rdbr/web/array_value_helpers.rb', line 19 def render_array_value(value) render_deferred_value(array_text(value), qualifier: 'array', summary: array_summary(value)) end |