module Card::Env::SlotOptions

slot-related environmental variable handling

Public Instance Methods

slot_opts() click to toggle source
# File lib/card/env/slot_options.rb, line 5
def slot_opts
  # FIXME:  upgrade to safe parameters
  @slot_opts ||= interpret_slot_options
end

Private Instance Methods

interpret_slot_options() click to toggle source
# File lib/card/env/slot_options.rb, line 12
def interpret_slot_options
  opts = hash params[:slot]
  opts.merge! shortcut_slot_opts
  opts.deep_symbolize_keys.slice(*Card::View::Options.slot_keys)
end
shortcut_slot_opts() click to toggle source
# File lib/card/env/slot_options.rb, line 18
def shortcut_slot_opts
  opts = {}
  opts[:size] = params[:size].to_sym if params[:size]
  opts[:items] = { view: params[:item].to_sym } if slot_items_shortcut?
  opts
end
slot_items_shortcut?() click to toggle source
# File lib/card/env/slot_options.rb, line 25
def slot_items_shortcut?
  params[:item].present? && !params.dig(:slot, :items, :view).present?
end