# frozen_string_literal: true

require_relative 'appinfo'

# Helpers - view helper functions
module Helpers

  def ruby_version
    return RUBY_VERSION
  end

  def app_version
    return AppInfo::VERSION
  end

  def date_format(date)
    dt = date.to_datetime
    return dt.strftime('%B %d, %Y @ %I:%M:%S %p %Z')
  end

  def average_array(arr, decimals = 1)
    sum = 0

    arr.each do |i|
      sum += i
    end

    return (sum / arr.length).round(decimals)
  end

end
