class Collector::ArticleListItem

Public Class Methods

new(hash_or_invoice_row = {}) click to toggle source
Calls superclass method
# File lib/collector/article_list_item.rb, line 5
def initialize(hash_or_invoice_row = {})
  if hash_or_invoice_row.kind_of? Hash
    super(hash_or_invoice_row)
  elsif hash_or_invoice_row.kind_of? InvoiceRow
    hash = attributes.inject({}) do |memo, attr|
      memo[attr] = hash_or_invoice_row.send(attr)
      memo
    end
    super(hash)
  else
    raise ArgumentError.new("An ArticleListItem must be initialized with a hash or an InvoiceRow instance.")
  end
end