Class: FlexStationData::Presenters::PlatesHash

Inherits:
Object
  • Object
show all
Includes:
Callable[:present]
Defined in:
lib/flex_station_data/presenters/plates_hash.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file, plates, **options) ⇒ PlatesHash

Returns a new instance of PlatesHash.



12
13
14
15
16
# File 'lib/flex_station_data/presenters/plates_hash.rb', line 12

def initialize(file, plates, **options)
  @file = file
  @plates = plates
  @options = options
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



10
11
12
# File 'lib/flex_station_data/presenters/plates_hash.rb', line 10

def file
  @file
end

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/flex_station_data/presenters/plates_hash.rb', line 10

def options
  @options
end

#platesObject (readonly)

Returns the value of attribute plates.



10
11
12
# File 'lib/flex_station_data/presenters/plates_hash.rb', line 10

def plates
  @plates
end

Instance Method Details

#presentObject



18
19
20
21
22
23
# File 'lib/flex_station_data/presenters/plates_hash.rb', line 18

def present
  base = { "file" => file.basename.to_s }
  plates.flat_map do |plate|
    PlateHash.present(plate, **options).map(&base.method(:merge))
  end
end