class UkParliament::DocPipeline

Class defining the pipeline process for a scraped document.

Public Class Methods

new(house_id, document) click to toggle source

Initialise the class instance variables.

# File lib/uk_parliament/doc_pipeline.rb, line 7
def initialize(house_id, document)
  @house_id = house_id
  @document = document

  define_commons_tasks
  define_lords_tasks
end

Protected Instance Methods

execute() click to toggle source

Execute the relevant pipeline's tasks.

# File lib/uk_parliament/doc_pipeline.rb, line 30
def execute
  # TODO We can do this better.
  if @house_id == Commons::HOUSE_ID
    @commons_tasks.each { |function_name|
      send(function_name)
    }
  elsif @house_id == Lords::HOUSE_ID
    @lords_tasks.each { |function_name|
      send(function_name)
    }
  end
end

Private Instance Methods

define_commons_tasks() click to toggle source

Define the tasks that will be performed for a commons pipeline.

# File lib/uk_parliament/doc_pipeline.rb, line 18
def define_commons_tasks
  @commons_tasks = []
end
define_lords_tasks() click to toggle source

Define the tasks that will be performed for a lords pipeline.

# File lib/uk_parliament/doc_pipeline.rb, line 23
def define_lords_tasks
  @lords_tasks = []
end