Sha256: c1127bfbe220881ec58de86003c0de1fb2b63b4a1cdb45e13b5a7900ad9293f2

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

require "maxwell/converter"
require 'csv'

class Maxwell
  def self.DO(config_hash, &block)
    url, next_config = config_hash.first
    html = Maxwell::Converter.execute url
    if next_config.is_a?(Proc)
      result = next_config.call(html)
      block.call(result)
    else
      target, next_config = next_config.first
      html.css(target).each do |a|
        self.DO({ a[:href] => next_config }, &block)
      end
    end
  end
end

class ::String
  def trim
    delete("\r\n\t")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maxwell-0.1.0 lib/maxwell.rb