Class: Edoxen::VenueValidator
- Inherits:
-
Object
- Object
- Edoxen::VenueValidator
- Defined in:
- lib/edoxen/venue_validator.rb,
sig/edoxen.rbs
Overview
VenueValidator — validates Venue instances using the unlocodes
and iata gems. Returns a list of errors; empty list means valid.
For PhysicalVenue with a unlocode or iata_code field, validates
that the code exists in the canonical registries. Optionally
auto-populates city/country_code/coordinates from the registry.
Instance Attribute Summary collapse
-
#errors ⇒ Array[String]
readonly
Returns the value of attribute errors.
-
#venue ⇒ Venue
readonly
Returns the value of attribute venue.
Instance Method Summary collapse
-
#initialize(venue) ⇒ VenueValidator
constructor
A new instance of VenueValidator.
- #valid? ⇒ Boolean
- #validate(auto_populate: false) ⇒ Array[String]
Constructor Details
#initialize(venue) ⇒ VenueValidator
Returns a new instance of VenueValidator.
13 14 15 16 |
# File 'lib/edoxen/venue_validator.rb', line 13 def initialize(venue) @venue = venue @errors = [] end |
Instance Attribute Details
#errors ⇒ Array[String] (readonly)
Returns the value of attribute errors.
11 12 13 |
# File 'lib/edoxen/venue_validator.rb', line 11 def errors @errors end |
#venue ⇒ Venue (readonly)
Returns the value of attribute venue.
11 12 13 |
# File 'lib/edoxen/venue_validator.rb', line 11 def venue @venue end |
Instance Method Details
#valid? ⇒ Boolean
24 25 26 27 |
# File 'lib/edoxen/venue_validator.rb', line 24 def valid? validate errors.empty? end |
#validate(auto_populate: false) ⇒ Array[String]
18 19 20 21 22 |
# File 'lib/edoxen/venue_validator.rb', line 18 def validate(auto_populate: false) validate_physical(auto_populate: auto_populate) if venue.physical? errors end |