class Supa::Commands::Collection
Public Instance Methods
represent()
click to toggle source
# File lib/supa/commands/collection.rb, line 4 def represent return if hide? define_tree return unless value value.each do |element| @tree[@name] << {} Supa::Builder.new(element, representer: @representer, tree: @tree[@name][-1]).instance_exec(&@block) end end
Private Instance Methods
apply_render_flags(val)
click to toggle source
# File lib/supa/commands/collection.rb, line 20 def apply_render_flags(val) return [] if !val && empty_when_nil? val end
define_tree()
click to toggle source
# File lib/supa/commands/collection.rb, line 32 def define_tree @tree[@name] = !value ? nil : [] end
hide?()
click to toggle source
# File lib/supa/commands/collection.rb, line 25 def hide? return hide_when_empty? unless value return false unless value.is_a?(Array) value.any? ? false : hide_when_empty? end