Module: PageCreator::Pages

Defined in:
lib/page_creator/pages.rb

Overview

Creates or calls instances of pages used in tests.

Class Method Summary collapse

Class Method Details

.collect_pages(subclass) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/page_creator/pages.rb', line 4

def self.collect_pages(subclass)
  method_name = subclass.to_s.demodulize.underscore
  send(:define_method, method_name) do
    instance_variable_set("@#{method_name}",
      instance_variable_get("@#{method_name}") || subclass.new)
  end
end