Class: RUTL::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/rutl/application.rb

Overview

Application, this top-level class, controls a browser and a fake browser. It will soon call into apps, at which point I need to rethink this naming convention.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(family:, type:, views: RUTL::VIEWS || ENV['RUTL_VIEWS']) ⇒ Application

Returns a new instance of Application.



17
18
19
20
21
22
23
# File 'lib/rutl/application.rb', line 17

def initialize(family:, type:, views: RUTL::VIEWS || ENV['RUTL_VIEWS'])
  raise 'Must set views!' if views.nil? || views.empty?
  # This is kind of evil. Figure out how to ditch the $ variable.
  $application = self
  @interface = load_interface(family: family, type: type)
  @interface.views = load_views(directory: views)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/rutl/application.rb', line 25

def method_missing(method, *args, &block)
  if args.empty?
    @interface.send(method)
  else
    @interface.send(method, *args, &block)
  end
end

Instance Attribute Details

#interfaceObject (readonly)

Returns the value of attribute interface.



11
12
13
# File 'lib/rutl/application.rb', line 11

def interface
  @interface
end

Instance Method Details

#respond_to_missing?(*args) ⇒ Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/rutl/application.rb', line 33

def respond_to_missing?(*args)
  @interface.respond_to?(*args)
end

#screenshotObject



13
14
15
# File 'lib/rutl/application.rb', line 13

def screenshot
  @interface.camera.screenshot
end