Class: InstrumentLoaderCsv

Inherits:
InstrumentLoader show all
Defined in:
app/services/instrument_loader_csv.rb

Overview

Loads instruments from csv

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from InstrumentLoader

#load

Instance Attribute Details

#folderObject (readonly)

Returns the value of attribute folder


12
13
14
# File 'app/services/instrument_loader_csv.rb', line 12

def folder
  @folder
end

#instrumentObject (readonly)

Returns the value of attribute instrument


10
11
12
# File 'app/services/instrument_loader_csv.rb', line 10

def instrument
  @instrument
end

#response_scaleObject (readonly)

Returns the value of attribute response_scale


11
12
13
# File 'app/services/instrument_loader_csv.rb', line 11

def response_scale
  @response_scale
end

Instance Method Details

#load_instrument(instrument:) ⇒ Object

Returns an array of Items that represent the questions in an instrument.


15
16
17
18
19
20
21
22
# File 'app/services/instrument_loader_csv.rb', line 15

def load_instrument(instrument:)
  @instrument = instrument
  load_content
  load_attributes
  load_response_scale(name: instrument.name)
  load_items
  instrument
end

#use_folder(folder: AppConstants::INSTRUMENTS_FOLDER) ⇒ Object


24
25
26
# File 'app/services/instrument_loader_csv.rb', line 24

def use_folder(folder: AppConstants::INSTRUMENTS_FOLDER)
  @folder = folder
end