Sha256: d888b0762b33cdc0664c5565a5672feb61ceeaa41c4705743478e53152039649
Contents?: true
Size: 615 Bytes
Versions: 2
Compression:
Stored size: 615 Bytes
Contents
#! /usr/bin/env ruby # coding: utf-8 require "yaml" # Series name is composed only of alphabets. # Host name is started by the series name and followed by integers. # E.g., # "Fe", "Fe00", "Fe01" are of series "Fe" and not "F" # class MachineInfo class NoEntryError < Exception; end # def initialize(data) @data = data end def self.load_file(data_file = (ENV["HOME"] + "/.machineinfo")) data = YAML.load_file(data_file) MachineInfo.new data end def get_info(host) series = host.sub(/\d*$/, "") raise NoEntryError unless @data.has_key?(series) @data[series] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
comana-0.0.7 | lib/comana/machineinfo.rb |
comana-0.0.6 | lib/comana/machineinfo.rb |