class Sas2ircu::Parser

Attributes

cards[RW]

Public Class Methods

new() click to toggle source
# File lib/disk_reporter/sas2ircu_parser.rb, line 151
def initialize
  self.cards = {}
  populate
end

Public Instance Methods

number_of_cards() click to toggle source
# File lib/disk_reporter/sas2ircu_parser.rb, line 156
def number_of_cards
  @no_cards ||= `sas2ircu list | grep Index| wc -l`
  @no_cards = @no_cards.delete("\n").to_i
end
populate() click to toggle source
# File lib/disk_reporter/sas2ircu_parser.rb, line 161
def populate
  (0..(number_of_cards - 1)).each do |card_id|
    self.cards[card_id] = Card.new(card_id)
  end
end
to_h() click to toggle source
# File lib/disk_reporter/sas2ircu_parser.rb, line 167
def to_h
  cr = {} 
  cards.each do |_k,c|
    cr[c.id] = c.to_h
  end
  { cards: cr }
end