Sha256: 51d6e01aecbf614d093aa254c1eeb3879134be5aae685faf3056c8d0cb0c0af3

Contents?: true

Size: 778 Bytes

Versions: 12

Compression:

Stored size: 778 Bytes

Contents

require 'lazyman/errors'
module Lazyman
	class Page
		include PageObject	

		def method_missing(m, *args, &blk)
			if @browser.respond_to? m
				@browser.send(m, *args, &blk)
			else
				super
			end #if
		end 

		def turn_to kls
			raise InvalidLazymanPageError unless kls <= Lazyman::Page
			kls.new(@browser)
		end

		def data_driven hash, &blk
			raise ArgumentError unless hash.is_a?(Hash)
			hash.each do |mtd, data|
				m_with_eql = (mtd.to_s + '=').to_sym
				if respond_to?(m_with_eql)
					#self.send(m_with_eql, data)
					eval "self.#{m_with_eql.to_s}(data)"
				elsif respond_to?(mtd.to_sym)
					self.send(mtd.to_sym).send(data.to_sym) 
				end #if
			end #each
			class_eval &blk if block_given?
		end

	end #Page

end #Lazyman

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
lazyman-0.1.14 lib/lazyman/lazy_page.rb
lazyman-0.1.13 lib/lazyman/lazy_page.rb
lazyman-0.1.12 lib/lazyman/lazy_page.rb
lazyman-0.1.11 lib/lazyman/lazy_page.rb
lazyman-0.1.10 lib/lazyman/lazy_page.rb
lazyman-0.1.9 lib/lazyman/lazy_page.rb
lazyman-0.1.8 lib/lazyman/lazy_page.rb
lazyman-0.1.7 lib/lazyman/lazy_page.rb
lazyman-0.1.6 lib/lazyman/lazy_page.rb
lazyman-0.1.5 lib/lazyman/lazy_page.rb
lazyman-0.1.4 lib/lazyman/lazy_page.rb
lazyman-0.1.3 lib/lazyman/lazy_page.rb