Sha256: f6892c12c650bc988ef3d36263a6b1482efc13e84a12c7258eed8f49c8ef412d

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

#coding: utf-8
require 'wombat/property_locator'
require 'mechanize'

module Wombat
  class Parser
    include PropertyLocator
    attr_accessor :mechanize, :context

    def initialize
      @mechanize = Mechanize.new
    end

    def parse metadata
      @context = @mechanize.get("#{metadata.base_url}#{metadata.event_list_page}").parser

      locate metadata

      [metadata.event_props, metadata.venue_props, metadata.location_props].flat_map { |p| p.all_properties }.each do |p|
        p.callback.call(p.result) if p.callback
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wombat-0.1.2 lib/wombat/parser.rb
wombat-0.1.1 lib/wombat/parser.rb