class Array

Public Instance Methods

include_sequence?(*elements) click to toggle source
# File lib/bashly/extensions/array.rb, line 17
def include_sequence?(*elements)
  return false if elements.empty?

  each_cons(elements.size).any?(elements)
end
indent(offset) click to toggle source
# File lib/bashly/extensions/array.rb, line 4
def indent(offset)
  return self unless offset.positive?

  indentation = ' ' * offset
  indenter = Bashly::IndentationHelper.new indentation

  map { |line| indenter.indent line }
end
nonuniq() click to toggle source
# File lib/bashly/extensions/array.rb, line 13
def nonuniq
  tally.select { |_key, count| count > 1 }.keys
end