Class: GenericApplication

Inherits:
Object
  • Object
show all
Includes:
ExtensionHelpers, GenericActions, WindowPositionAndResizeActions
Defined in:
lib/generic_application.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from WindowPositionAndResizeActions

#absolutize_size, #current_bounds, #height, #position, #position_top_left_corner_at, #resize, #transition_to_bounds, #width

Methods included from ExtensionHelpers

#extension, #extension_path, #load_extension!

Methods included from GenericActions

#close_all_windows, #ensure_launched, #keystroke, #method_missing, #minimize_all_windows, #wait_for_me!

Constructor Details

#initialize(opts) ⇒ GenericApplication

Returns a new instance of GenericApplication.



144
145
146
147
# File 'lib/generic_application.rb', line 144

def initialize(opts)
  opts.each_pair { |k,v| self.send("#{k}=", v) }
  self.app = Appscript.app(name)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GenericActions

Instance Attribute Details

#appObject

Returns the value of attribute app.



142
143
144
# File 'lib/generic_application.rb', line 142

def app
  @app
end

#nameObject

Returns the value of attribute name.



142
143
144
# File 'lib/generic_application.rb', line 142

def name
  @name
end

Class Method Details

.find_by_string(name) ⇒ Object



149
150
151
152
153
154
155
156
157
158
159
# File 'lib/generic_application.rb', line 149

def self.find_by_string(name)
  if Appscript.app(name)
    application = GenericApplication.new(:name => name)
    application.load_extension!
    Kernel.const_set(name, application)
    return application
  else
    STDERR.puts "Couldn't find application named: #{name}"
    return false
  end
end