module Card::Format::Nesting::Main

Handle the main nest

Public Instance Methods

already_mained?() click to toggle source
# File lib/card/format/nesting/main.rb, line 30
def already_mained?
  return true if @main || @already_main

  @already_main = true
  false
end
main!() click to toggle source
# File lib/card/format/nesting/main.rb, line 37
def main!
  @main = true
end
main_nest(opts) click to toggle source
# File lib/card/format/nesting/main.rb, line 10
def main_nest opts
  wrap_main do
    main.rendered || main_nest_render(opts)
  end
end
main_nest?(nest_name) click to toggle source
# File lib/card/format/nesting/main.rb, line 26
def main_nest? nest_name
  nest_name == "_main" # && !root.already_mained?
end
main_nest_options() click to toggle source

view=edit&items=closed

# File lib/card/format/nesting/main.rb, line 42
def main_nest_options
  inherit(:main_opts) || {}
end
main_nest_render(opts={}) click to toggle source
# File lib/card/format/nesting/main.rb, line 16
def main_nest_render opts={}
  with_nest_mode :normal do
    if block_given?
      block.call
    else
      nest root.card, opts.merge(main_view: true, main: true)
    end
  end
end
wrap_main() { || ... } click to toggle source
# File lib/card/format/nesting/main.rb, line 6
def wrap_main
  yield # no wrapping in base format
end