Sha256: 6ae182d0444f29481a9d6764882d39aecf5547ca48a27d9cf7efaa89ba7e3151

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

#coding: utf-8
require 'wombat/property/locators/base'
require 'wombat/property/locators/follow'
require 'wombat/property/locators/html'
require 'wombat/property/locators/iterator'
require 'wombat/property/locators/property_group'
require 'wombat/property/locators/list'
require 'wombat/property/locators/text'
require 'wombat/property/locators/headers'

class Wombat::Property::Locators::UnknownTypeException < Exception; end;

module Wombat
  module Property
    module Locators
      module Factory
        def self.locator_for(property)
          klass = case(property.wombat_property_format)
          when :text
            Text
          when :list
            List
          when :html
            Html
          when :iterator
            Iterator
          when :container
            PropertyGroup
          when :follow
            Follow
          when :headers
            Headers
          else
            raise Wombat::Property::Locators::UnknownTypeException.new("Unknown property format #{property.format}.")
          end

          klass.new(property)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wombat-3.0.0 lib/wombat/property/locators/factory.rb
wombat-2.10.0 lib/wombat/property/locators/factory.rb
wombat-2.9.0 lib/wombat/property/locators/factory.rb
wombat-2.8.0 lib/wombat/property/locators/factory.rb
wombat-2.7.0 lib/wombat/property/locators/factory.rb
wombat-2.6.0 lib/wombat/property/locators/factory.rb
wombat-2.5.1 lib/wombat/property/locators/factory.rb
wombat-2.5.0 lib/wombat/property/locators/factory.rb