Module: Card::Format::Nest::Subformat

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

Instance Method Summary collapse

Instance Method Details

#field_subformat(field) ⇒ Object



13
14
15
16
# File 'lib/card/format/nest/subformat.rb', line 13

def field_subformat field
  field = card.cardname.field(field) unless field.is_a?(Card)
  subformat field
end

#subformat(subcard) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/card/format/nest/subformat.rb', line 5

def subformat subcard
  subcard = Card.fetch(subcard, new: {}) if subcard.is_a?(String)
  self.class.new subcard, root: @root, parent: self, depth: @depth + 1,
                          form: @form,
                          mode: @mode,
                          context_names: @context_names
end