class Array

Public Instance Methods

abbrev(pattern = nil) click to toggle source

Calculates the set of unambiguous abbreviations for the strings in self. If passed a pattern or a string, only the strings matching the pattern or starting with the string are considered.

%w{ car cone }.abbrev   #=> { "ca" => "car", "car" => "car",
                              "co" => "cone", "con" => cone",
                              "cone" => "cone" }
# File rake/lib/abbrev.rb, line 89
def abbrev(pattern = nil)
  Abbrev::abbrev(self, pattern)
end
pretty_print(q) click to toggle source
# File rake/lib/pp.rb, line 336
def pretty_print(q)
  q.group(1, '[', ']') {
    q.seplist(self) {|v|
      q.pp v
    }
  }
end
pretty_print_cycle(q) click to toggle source
# File rake/lib/pp.rb, line 344
def pretty_print_cycle(q)
  q.text(empty? ? '[]' : '[...]')
end
shelljoin → string click to toggle source

Builds a command line string from an argument list array joining all elements escaped for Bourne shell and separated by a space. See Shellwords.shelljoin for details.

# File rake/lib/shellwords.rb, line 148
def shelljoin
  Shellwords.join(self)
end
to_csv(options = Hash.new) click to toggle source

Equivalent to CSV::generate_line(self, options).

# File rake/lib/csv.rb, line 2345
def to_csv(options = Hash.new)
  CSV.generate_line(self, options)
end