Class: Wagon::Ward

Inherits:
Page
  • Object
show all
Defined in:
lib/wagon/ward.rb

Instance Attribute Summary

Attributes inherited from Page

#connection

Instance Method Summary collapse

Methods inherited from Page

#get, #initialize, #method_missing, #post, #source

Constructor Details

This class inherits a constructor from Wagon::Page

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wagon::Page

Instance Method Details

#directoryObject



13
14
15
# File 'lib/wagon/ward.rb', line 13

def directory
  @directory ||= Directory.new(connection, directory_path, self)
end

#directory_pathObject



9
10
11
# File 'lib/wagon/ward.rb', line 9

def directory_path
  @directory_path ||= self.at('a.directory[href^="/units/a/directory"]')['href']
end

#householdsObject



17
18
19
# File 'lib/wagon/ward.rb', line 17

def households
  directory.households
end

#membersObject



21
22
23
# File 'lib/wagon/ward.rb', line 21

def members
  households.collect(&:members).flatten()
end

#nameObject



5
6
7
# File 'lib/wagon/ward.rb', line 5

def name
  @name ||= self.at('a.channeltitle[href^="/units/home"]').inner_text.strip
end

#to_pdf(options) ⇒ Object



25
26
27
# File 'lib/wagon/ward.rb', line 25

def to_pdf(options)
  directory.to_pdf(options)
end