module DTK::Client::AssemblyTemplateMixin::ServiceSetting

Public Class Methods

parse(setting) click to toggle source
# File lib/commands/common/thor/assembly_template.rb, line 69
def self.parse(setting)
  if setting =~ /(^[^\(]+)\((.+)\)$/
    name = $1
    param_string = $2
    {:name => name, :parameters => parse_params(param_string)}
  else
    {:name => setting}
  end
end

Private Class Methods

parse_params(param_string) click to toggle source
# File lib/commands/common/thor/assembly_template.rb, line 79
def self.parse_params(param_string)
  param_string.split(',').inject(Hash.new) do |h,av_pair|
    if av_pair =~ /(^[^=]+)=(.+$)/
      attr = $1
      val = $2
      h.merge(attr => val)
    else
      raise DtkError,"[ERROR] Settings param string is ill-formed"
    end
  end
end