Class: AtlasEngine::Restrictions::UnsupportedScript

Inherits:
Object
  • Object
show all
Extended by:
Base, T::Sig
Defined in:
app/lib/atlas_engine/restrictions/unsupported_script.rb

Class Method Summary collapse

Methods included from Base

apply?

Class Method Details

.apply?(address:, params: {}) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
21
22
23
24
25
26
27
# File 'app/lib/atlas_engine/restrictions/unsupported_script.rb', line 17

def apply?(address:, params: {})
  supported_script = params[:supported_script]
  return false if supported_script.nil?

  scripts = Worldwide.scripts.identify(
    text: address.address1.to_s + " " + address.address2.to_s + " " + address.city.to_s,
  )
  return false if scripts.empty?

  scripts.any? { |script| script != supported_script }
end