Sha256: e90e736fa5bb1fa5912a02b55fc5d8a0fa19280060c74f04c9ed740ab544fec4

Contents?: true

Size: 452 Bytes

Versions: 10

Compression:

Stored size: 452 Bytes

Contents

module AppPrism
  module ScreenFactory
    def on_page(page_class, *args)
      page_class = class_from_string(page_class) if page_class.is_a? String
      @current_screen = page_class.new(@browser)
    end

    alias_method :on, :on_page

    def class_from_string(class_name)
      parts = class_name.split("::")
      constant = Object
      parts.each do |part|
        constant = constant.const_get(part)
      end
      constant
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
app_prism-0.1.0 lib/app_prism/screen_factory.rb
app_prism-0.0.12 lib/app_prism/screen_factory.rb
app_prism-0.0.11 lib/app_prism/screen_factory.rb
app_prism-0.0.10 lib/app_prism/screen_factory.rb
app_prism-0.0.8 lib/app_prism/screen_factory.rb
app_prism-0.0.6 lib/app_prism/screen_factory.rb
app_prism-0.0.5 lib/app_prism/screen_factory.rb
app_prism-0.0.4 lib/app_prism/screen_factory.rb
app_prism-0.0.3 lib/app_prism/screen_factory.rb
app_prism-0.0.2 lib/app_prism/screen_factory.rb