Class/Module Index [+]

Quicksearch

OpenShift::Controller::Configuration

Public Class Methods

parse_expiration(specs, default) click to toggle source

Comma delimited list of expiration pairs, where the key corresponds the canonical form of a scope, and the value corresponds to one or two time durations. The time durations may be specified in ruby and are converted to seconds. The key '*' corresponds to default.

# File lib/openshift/controller/configuration.rb, line 9
def self.parse_expiration(specs, default)
  (specs || '').split(',').inject({nil => [default.seconds]}) do |h, e|
    key, range = e.split('=').map(&:strip)
    key = nil if key == '*'
    values = range.split('|').map(&:strip).map{ |s| eval(s).seconds }
    h[key] = values
    h
  end
end
parse_list(list) click to toggle source

Parses a comma-separated string to an array, removing extra whitespace and empty elements. Nil input returns nil. Empty input returns empty array.

# File lib/openshift/controller/configuration.rb, line 20
def self.parse_list(list)
  if list.nil?
    nil
  else
    list.split(',').map(&:strip).map(&:presence).compact
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.