class Supa::Commands::Object

Public Instance Methods

represent() click to toggle source
# File lib/supa/commands/object.rb, line 4
def represent
  return @tree[@name] = nil unless value || hide?
  return if hide?

  @tree[@name] = {}

  Supa::Builder.new(
    value,
    representer: @representer,
    tree: @tree[@name]
  ).instance_exec(&@block)
end

Private Instance Methods

apply_render_flags(val) click to toggle source
# File lib/supa/commands/object.rb, line 19
def apply_render_flags(val)
  return {} if !val && empty_when_nil?
  val
end
hide?() click to toggle source
# File lib/supa/commands/object.rb, line 24
def hide?
  return hide_when_empty? unless value
  return false unless value.is_a?(Hash)

  value.empty? ? hide_when_empty? : false
end