Module: Paf::Formattable

Included in:
Paf
Defined in:
lib/paf/formattable.rb

Overview

Processing to format a PAF entry

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#formatObject

Formats a Paf instance into an array of strings



33
34
35
36
37
38
39
# File 'lib/paf/formattable.rb', line 33

def format
  array = lines
  self.class.post_attrs.each do |attr|
    array << send(attr) unless send(attr).vacant?
  end
  array
end

#to_sObject

Formats a Paf instance into a string



42
43
44
45
# File 'lib/paf/formattable.rb', line 42

def to_s
  string = (lines + [post_town]).condense.join(', ')
  ([string] + [postcode]).condense.join('. ')
end