Module: HireFire::Resource

Extended by:
Resource
Included in:
Resource
Defined in:
lib/hirefire/resource.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dynosArray

Returns The configured dynos.

Returns:

  • (Array)

    The configured dynos.



9
10
11
# File 'lib/hirefire/resource.rb', line 9

def dynos
  @dynos
end

Instance Method Details

#configure {|HireFire::Resource| ... } ⇒ Object

Sets the ‘@dynos` instance variable to an empty Array to hold all the dyno configuration.

Examples:

Resource Configuration

HireFire::Resource.configure do |config|
  config.dyno(:worker) do
    # Macro or Custom logic for the :worker dyno here..
  end
end

Yields:



22
23
24
25
# File 'lib/hirefire/resource.rb', line 22

def configure
  @dynos ||= []
  yield self
end

#dyno(name, &block) ⇒ Object

Will be used through block-style configuration with the ‘configure` method.

Parameters:

  • name (Symbol, String)

    the name of the dyno as defined in the Procfile.

  • block (Proc)

    an Integer containing the quantity calculation logic.



32
33
34
# File 'lib/hirefire/resource.rb', line 32

def dyno(name, &block)
  @dynos << { :name => name, :quantity => block }
end