Class: CertificateFactory::CSVFactory
- Defined in:
- lib/certificate-factory/factory.rb
Instance Attribute Summary
Attributes inherited from Factory
Instance Method Summary collapse
- #each ⇒ Object
- #get_link(url) ⇒ Object
-
#initialize(options) ⇒ CSVFactory
constructor
A new instance of CSVFactory.
Methods inherited from Factory
#build, #ckan_url, #feed_items, #fetch_next_page, #next_page, #over_limit?
Constructor Details
#initialize(options) ⇒ CSVFactory
Returns a new instance of CSVFactory.
69 70 71 72 73 74 75 |
# File 'lib/certificate-factory/factory.rb', line 69 def initialize() @file = [:file] @limit = [:limit] @campaign = [:campaign] @count = 0 @logger = [:logger] end |
Instance Method Details
#each ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/certificate-factory/factory.rb', line 81 def each CSV::foreach(@file, headers: :first_row) do |row| yield row['documentation_url'] @count += 1 break if over_limit? end end |
#get_link(url) ⇒ Object
77 78 79 |
# File 'lib/certificate-factory/factory.rb', line 77 def get_link(url) return url end |