Class: Pairwise::InputFile

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ InputFile

Returns a new instance of InputFile.



15
16
17
18
# File 'lib/pairwise/input_file.rb', line 15

def initialize(filename)
  @filename = filename
  self.extend(input_file_module)
end

Class Method Details

.load(filename) ⇒ Object



5
6
7
8
# File 'lib/pairwise/input_file.rb', line 5

def load(filename)
  inputs = self.new(filename).load_and_parse
  InputData.new(inputs) if valid?(inputs)
end

.valid?(inputs) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/pairwise/input_file.rb', line 10

def valid?(inputs)
  inputs && (inputs.is_a?(Array) || inputs.is_a?(Hash))
end