DannyBen/bashly

View on GitHub
lib/bashly/extensions/array.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'bashly/concerns/indentation_helper'

class Array
  def indent(offset)
    return self unless offset.positive?

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

    map { |line| indenter.indent line }
  end

  def nonuniq
    tally.select { |_key, count| count > 1 }.keys
  end
end