Class: Card::Format::Nest

Inherits:
Object
  • Object
show all
Includes:
Fetch
Defined in:
lib/card/format/nest.rb,
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.



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

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 'lib/card/format/nest.rb', line 7

def card
  @card
end

#formatObject

Returns the value of attribute format.



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

def format
  @format
end

#format_optsObject

Returns the value of attribute format_opts.



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

def format_opts
  @format_opts
end

#viewObject

Returns the value of attribute view.



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

def view
  @view
end

#view_optsObject

Returns the value of attribute view_opts.



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

def view_opts
  @view_opts
end

Instance Method Details

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

Yields:



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

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