Class: Reader

Inherits:
Object
  • Object
show all
Defined in:
lib/xlsx_to_k8s_network_policy.rb

Overview

Reads an XLSX file and creates the NetworkPolicy

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Reader

Returns a new instance of Reader.



291
292
293
# File 'lib/xlsx_to_k8s_network_policy.rb', line 291

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



285
286
287
# File 'lib/xlsx_to_k8s_network_policy.rb', line 285

def file
  @file
end

Class Method Details

.read(file) ⇒ Object



287
288
289
# File 'lib/xlsx_to_k8s_network_policy.rb', line 287

def self.read(file)
  Reader.new(file).read
end

Instance Method Details

#readObject



295
296
297
298
299
300
301
# File 'lib/xlsx_to_k8s_network_policy.rb', line 295

def read
  @xlsx = Roo::Spreadsheet.open('./test/fixtures/network_policy.xlsx')
  @network_policy = NetworkPolicies.new
  read_zones
  read_rules
  @network_policy
end