Class: Rsvp::Salutation::HusbandWifeAndChildren

Inherits:
Rsvp::Salutation show all
Defined in:
app/models/rsvp/salutation/husband_wife_and_children.rb

Instance Attribute Summary

Attributes inherited from Rsvp::Salutation

#family

Instance Method Summary collapse

Methods inherited from Rsvp::Salutation

#initialize, #to_s

Constructor Details

This class inherits a constructor from Rsvp::Salutation

Instance Method Details

#childrenObject



6
7
8
9
10
11
12
13
14
# File 'app/models/rsvp/salutation/husband_wife_and_children.rb', line 6

def children
  names = ""
  children = family.people.children
  children.each_with_index do |child, index|
    names << " and" if children.size > 1 && (index + 1) == children.size
    names << " #{child.first_name}"
  end
  names.strip
end

#maleObject



3
4
5
# File 'app/models/rsvp/salutation/husband_wife_and_children.rb', line 3

def male
  family.people.adult_males.first
end

#templateObject



15
16
17
# File 'app/models/rsvp/salutation/husband_wife_and_children.rb', line 15

def template
  "Mr. and Mrs. [[male__first_name]] [[male__last_name]], [[children]]"
end