Sha256: b644b657aef0fa87a81be2adf69ab8471b9e5ff0580db3134a4a976c776db0bd

Contents?: true

Size: 608 Bytes

Versions: 1

Compression:

Stored size: 608 Bytes

Contents

require "rubyul/version"

require "date"
require "json"

# All the small helper functions are here.
module Rubyul
  def self.academic_year(date)
    # Academic years go from September to August.
    (Date.parse(date) << 8).year
  end

  PLATFORM_REGEXES = JSON.parse(File.read(File.dirname(__FILE__) +
                                          "/platform_regexes.json"))

  def self.hostname_to_platform(hostname)
    # TODO: Deal with ignores or not, with an option.
    PLATFORM_REGEXES.each do |regexp, platform_name|
      return platform_name if Regexp.new(regexp) =~ hostname
    end
    nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyul-0.5.2 lib/rubyul.rb