lib/dsc/command.rb
# Parse fields argument. Either split the string or read from file
# @return [Array<String>] parse fields
Parse fields argument. Either split the string or read from file
Parse fields argument . Either split the string or read from file
def parse_fields(fields_string_or_filename_argument)
      filename = File.absolute_path(fields_string_or_filename_argument)
      if File.exists?(filename)
        fields_string = ""
        File.readlines(filename).each do |line|
          fields_string = fields_string + " " + line.strip_comments
        end
      else
        fields_string = fields_string_or_filename_argument
      end
      fields = fields_string.split(/[\s,]/).map(&:strip).reject(&:blank?)
      unknown_fields = fields.reject { |each| self.class.transport_class.has_attribute_chain(each) }
      raise "Unknown filename or field found (#{unknown_fields.join(', ')}) - known fields are: #{self.class.valid_fields.join(', ')}" unless unknown_fields.empty?
      fields
    end
def parse_fields ( fields_string_or_filename_argument ) filename = File . absolute_path ( fields_string_or_filename_argument ) if File . exists? ( filename ) fields_string = "" File . readlines ( filename ) . each do | line | fields_string = fields_string + " " + line . strip_comments end else fields_string = fields_string_or_filename_argument end fields = fields_string . split ( / [ \s ,] / ) . map ( & :strip ) . reject ( & :blank? ) unknown_fields = fields . reject { | each | self . class . transport_class . has_attribute_chain ( each ) } raise "Unknown filename or field found (#{unknown_fields.join(', ')}) - known fields are: #{self.class.valid_fields.join(', ')}" unless unknown_fields . empty? fields end
Parse fields argument.
Parse fields argument .
None
Array<String>
fields_string_or_filename_argument
<not_specific>