Sha256: dffb38294e596a4a2016da5893a0aa0dd1db4e1864079160a915d22d6a4acb55

Contents?: true

Size: 995 Bytes

Versions: 8

Compression:

Stored size: 995 Bytes

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-2.4.0 lib/wombat/property/locators/factory.rb
wombat-2.3.0 lib/wombat/property/locators/factory.rb
wombat-2.2.1 lib/wombat/property/locators/factory.rb
wombat-2.2.0 lib/wombat/property/locators/factory.rb
wombat-2.1.3 lib/wombat/property/locators/factory.rb
wombat-2.1.2 lib/wombat/property/locators/factory.rb
wombat-2.1.1 lib/wombat/property/locators/factory.rb
wombat-2.1.0 lib/wombat/property/locators/factory.rb