Class: HTTPalooza::Players::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/httpalooza/players/base.rb

Overview

This class is abstract.

Superclass for Player implementations

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Base

Returns a new instance of Base.



29
30
31
# File 'lib/httpalooza/players/base.rb', line 29

def initialize(request)
  @request = request
end

Class Attribute Details

.dependenciesObject (readonly)

Returns the value of attribute dependencies.



7
8
9
# File 'lib/httpalooza/players/base.rb', line 7

def dependencies
  @dependencies
end

.nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/httpalooza/players/base.rb', line 7

def name
  @name
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



27
28
29
# File 'lib/httpalooza/players/base.rb', line 27

def request
  @request
end

Class Method Details

.execute!(request) ⇒ Object



22
23
24
# File 'lib/httpalooza/players/base.rb', line 22

def execute!(request)
  new(request).response
end

.introducing!(name, dependencies = []) ⇒ Object

Create a new player and require any depenencies.

Examples:

introducing! :selenium, %w[ selenium-webdriver ]

Parameters:

  • name (Symbol)

    the name of the player

  • dependencies (Array) (defaults to: [])

    a list of dependencies require in order to use this player



16
17
18
19
20
# File 'lib/httpalooza/players/base.rb', line 16

def introducing!(name, dependencies = [])
  @name = name.to_sym
  @dependencies = dependencies
  Players.add(self)
end

Instance Method Details

#nameObject



33
34
35
# File 'lib/httpalooza/players/base.rb', line 33

def name
  self.class.name
end

#responseObject



37
38
39
# File 'lib/httpalooza/players/base.rb', line 37

def response
  raise NotImplementedError
end