Module: Card::Format::Nest::Fetch

Included in:
Card::Format::Nest
Defined in:
lib/card/format/nest/fetch.rb

Overview

Fetch card for a nest

Instance Method Summary collapse

Instance Method Details

#fetch_nested_card(cardish, opts = {}) ⇒ Object



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

def fetch_nested_card cardish, opts={}
  case cardish
  when Card            then cardish
  when Symbol, Integer then Card.fetch cardish
  when "_", "_self"    then card.context_card
  else
    opts[:nest_name] = cardish.to_s
    Card.fetch cardish, new: nest_new_args(opts)
  end
end