Class: Card::Format::Nest

Inherits:
Object show all
Includes:
Fetch
Defined in:
card/lib/card/format/nest.rb,
card/lib/card/format/nest/fetch.rb

Overview

processing nests

Defined Under Namespace

Modules: Fetch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(format, cardish, view_opts = {}, format_opts = {}) ⇒ Nest

Returns a new instance of Nest.



9
10
11
12
13
14
15
16
# File 'card/lib/card/format/nest.rb', line 9

def initialize format, cardish, view_opts={}, format_opts={}
  @format = format
  @view_opts = view_opts
  @format_opts = format_opts.clone
  @override = @format_opts.delete(:override) != false
  @card ||= fetch_card cardish
  # NOTE: fetch_card can alter view and view_opts[:nest_name]
end

Instance Attribute Details

#cardObject

Returns the value of attribute card.



7
8
9
# File 'card/lib/card/format/nest.rb', line 7

def card
  @card
end

#formatObject

Returns the value of attribute format.



7
8
9
# File 'card/lib/card/format/nest.rb', line 7

def format
  @format
end

#format_optsObject

Returns the value of attribute format_opts.



7
8
9
# File 'card/lib/card/format/nest.rb', line 7

def format_opts
  @format_opts
end

#viewObject

Returns the value of attribute view.



7
8
9
# File 'card/lib/card/format/nest.rb', line 7

def view
  @view
end

#view_optsObject

Returns the value of attribute view_opts.



7
8
9
# File 'card/lib/card/format/nest.rb', line 7

def view_opts
  @view_opts
end

Instance Method Details

#prepare {|subformat, view| ... } ⇒ Object

Yields:



18
19
20
21
22
23
# File 'card/lib/card/format/nest.rb', line 18

def prepare
  prepare_view_and_opts!
  subformat = prepare_subformat
  @view = subformat.modal_nest_view @view if @override
  yield subformat, view
end