Sha256: 06ead2f2e5d116f4f389134d7c960118fec1bc4a28e60bc539f9b3059dfb66c1

Contents?: true

Size: 449 Bytes

Versions: 1

Compression:

Stored size: 449 Bytes

Contents

module AppPrism
  module ScreenFactory
    def on(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

1 entries across 1 versions & 1 rubygems

Version Path
app_prism-0.0.9 lib/app_prism/screen_factory.rb