class FlightManifest::Manifest

Public Class Methods

file_properties() click to toggle source
# File lib/flight_manifest/manifest.rb, line 39
def self.file_properties
  @file_properties ||= []
end
file_property(property) click to toggle source
# File lib/flight_manifest/manifest.rb, line 47
def self.file_property(property)
  name = :"#{property}_file"
  self.file_properties << name
  property name, default: '', coerce: Pathname
end
files_properties() click to toggle source
# File lib/flight_manifest/manifest.rb, line 43
def self.files_properties
  @files_properties ||= []
end
files_property(property) click to toggle source
# File lib/flight_manifest/manifest.rb, line 53
def self.files_property(property)
  name = :"#{property}_files"
  self.files_properties << name
  property name, default: [], coerce: Array[Pathname]
end

Public Instance Methods

to_h() click to toggle source
Calls superclass method
# File lib/flight_manifest/manifest.rb, line 59
def to_h
  super().map { |k,v| [k.to_sym, v] }
         .to_h
         .tap do |hash|
    self.class.file_properties.each { |p| hash[p] = hash[p].to_s }
    self.class.files_properties.each { |p| hash[p] = hash[p].map(&:to_s) }
  end
end