Module: Card::Format::Nesting::Main
- Included in:
- Card::Format::Nesting
- Defined in:
- lib/card/format/nesting/main.rb
Overview
Handle the main nest
Instance Method Summary collapse
- #already_mained? ⇒ Boolean
- #main! ⇒ Object
- #main_nest(opts = {}) ⇒ Object
- #main_nest?(nest_name) ⇒ Boolean
-
#main_nest_options ⇒ Object
view=edit&items=closed.
- #wrap_main ⇒ Object
Instance Method Details
#already_mained? ⇒ Boolean
24 25 26 27 28 29 |
# File 'lib/card/format/nesting/main.rb', line 24 def already_mained? return true if @main || @already_main @already_main = true false end |
#main! ⇒ Object
31 32 33 |
# File 'lib/card/format/nesting/main.rb', line 31 def main! @main = true end |
#main_nest(opts = {}) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/card/format/nesting/main.rb', line 10 def main_nest 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 |
#main_nest?(nest_name) ⇒ Boolean
20 21 22 |
# File 'lib/card/format/nesting/main.rb', line 20 def main_nest? nest_name nest_name == "_main" # && !root.already_mained? end |
#main_nest_options ⇒ Object
view=edit&items=closed
36 37 38 39 40 41 |
# File 'lib/card/format/nesting/main.rb', line 36 def opts = inherit(:main_opts) || {} main_nest_size_opt opts main_nest_items_opt opts opts end |
#wrap_main ⇒ Object
6 7 8 |
# File 'lib/card/format/nesting/main.rb', line 6 def wrap_main yield # no wrapping in base format end |