Sha256: c5baac44569d87f3fb7d54b7aa16e7bb8a6f74f0703b1f215f2af3b99d2b29b4

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 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'

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
					else 
	      		raise Wombat::Property::Locators::UnknownTypeException.new("Unknown property format #{property.format}.")
					end

					klass.new(property)
				end
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wombat-2.0.1 lib/wombat/property/locators/factory.rb
wombat-2.0.0 lib/wombat/property/locators/factory.rb