Sha256: 4deded39e4850bcceeb5ec7db0257189db3e8d8b018eb1f947880975f377b6a1

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

require 'forwardable'

require 'base/page'

class PageSet
  extend Forwardable

  attr_accessor :session

  def page
    session
  end

  def execute &code
    self.instance_eval &code
  end

  def self.delegate_to_pages *pages
    pages.each do |page|
      class_name = camelize(page.to_s)
      clazz = Object.const_get(class_name)

      attr_reader page

      def_delegators page, *(clazz.instance_methods - Page.instance_methods)
    end
  end

  private

  def self.camelize string
    string.split("_").each {|s| s.capitalize! }.join("")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acceptance_test-1.4.1 lib/acceptance_test/page_set.rb