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

#log_queue_metricsBoolean

Returns True if the queue metrics option is enabled.

Returns:

  • (Boolean)

    True if the queue metrics option is enabled.



16
17
18
# File 'lib/hirefire/resource.rb', line 16

def log_queue_metrics
  @log_queue_metrics ||= false
end

Instance Method Details

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

Configures HireFire::Resource.

Examples:

Resource Configuration

HireFire::Resource.configure do |config|
  config.log_queue_metrics = true # disabled by default
  config.dyno(:worker) do
    # Macro or Custom logic for the :worker dyno here..
  end
end

Yields:



38
39
40
# File 'lib/hirefire/resource.rb', line 38

def configure
  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.



47
48
49
# File 'lib/hirefire/resource.rb', line 47

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

#dynosArray

Returns The configured dynos.

Returns:

  • (Array)

    The configured dynos.



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

def dynos
  @dynos ||= []
end