Class: Item::Materials::Checks::WoodShakeRoof

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/item/materials/checks/wood_shake_roof.rb

Overview

Service object: wood shake roof.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Instance Method Details

#process(container:, options: {}) ⇒ Object

rubocop:disable Lint/UnusedMethodArgument
options: is part of the shared Item::Materials::Checks polymorphic API
invoked by Item::Materials::Check#perform_checks_raw. Even though this
particular check ignores the value, the kwarg name has to stay as
options: so the bulk dispatch site keeps working.
:reek:UnusedParameters



19
20
21
22
23
24
25
26
# File 'app/services/item/materials/checks/wood_shake_roof.rb', line 19

def process(container:, options: {})
  # rubocop:enable Lint/UnusedMethodArgument
  return Result.new(status: :skipped) unless qualify?(container)

  material_alerts = []
  material_alerts << Item::Materials::Alert.new(name: "Please ensure installation of copper flashing on  Wood Shakes roof to accomodate a roof and gutter deicing system.", container: container)
  Result.new(status: :ok, alerts: material_alerts)
end

#qualify?(container) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'app/services/item/materials/checks/wood_shake_roof.rb', line 9

def qualify?(container)
  container.is_a?(RoomConfiguration) && container&.floor_type&.is_wood_shake?
end