Class: MaterialCodeGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/business/material_code_generator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(material_object, material_repository = Material) ⇒ MaterialCodeGenerator

Returns a new instance of MaterialCodeGenerator.



6
7
8
9
# File 'app/business/material_code_generator.rb', line 6

def initialize(material_object, material_repository = Material)
  self.material_object = material_object
  self.material_repository = material_repository
end

Instance Attribute Details

#material_objectObject

Returns the value of attribute material_object.



2
3
4
# File 'app/business/material_code_generator.rb', line 2

def material_object
  @material_object
end

#material_repositoryObject

Returns the value of attribute material_repository.



2
3
4
# File 'app/business/material_code_generator.rb', line 2

def material_repository
  @material_repository
end

Instance Method Details

#generate!Object



11
12
13
14
15
# File 'app/business/material_code_generator.rb', line 11

def generate!
  return unless materials_code_can_changed?

  material_object.code = material_code
end