Class: LibPtgBox::ProductFamily

Inherits:
Object
  • Object
show all
Defined in:
app/modules/lib_ptg_box/product_family.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(family_folder) ⇒ ProductFamily

Returns a new instance of ProductFamily


7
8
9
10
# File 'app/modules/lib_ptg_box/product_family.rb', line 7

def initialize(family_folder)
  @family_folder = family_folder
  @name = family_folder.name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


5
6
7
# File 'app/modules/lib_ptg_box/product_family.rb', line 5

def name
  @name
end

Instance Method Details

#catalogObject


16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/modules/lib_ptg_box/product_family.rb', line 16

def catalog
  @catalog ||= begin
    complete_marc_file = nil
    @family_folder.cataloging_marc_folder.marc_files.each do |marc_file|
      next unless /complete\.xml/i.match?(marc_file.name)

      complete_marc_file = marc_file
      break
    end
    Catalog.new(self, complete_marc_file)
  end
end

#productsObject


12
13
14
# File 'app/modules/lib_ptg_box/product_family.rb', line 12

def products
  @products ||= @family_folder.kbart_folder.kbart_files.map { |kbart_file| Product.new(self, kbart_file) }
end