Class: GovKit::CA::PostalCode::Strategy::Base
- Inherits:
-
Object
- Object
- GovKit::CA::PostalCode::Strategy::Base
- Includes:
- HTTParty
- Defined in:
- lib/gov_kit-ca/postal_code/strategy/base.rb
Overview
Abstract class for implementing postal code to electoral district strategies.
The following instance methods must be implemented in sub-classes:
electoral_districts!
The following class methods must be called in sub-classes:
http_method
path
Direct Known Subclasses
ConservativeCa, DigitalCopyrightCa, ElectionsCa, GreenPartyCa, LiberalCa, NDPCa, ParlGcCa
Instance Method Summary collapse
-
#electoral_districts ⇒ Array<Fixnum>
Returns the electoral districts within a postal code.
-
#initialize(postal_code) ⇒ Base
constructor
Creates a new postal code to electoral district strategy.
Constructor Details
#initialize(postal_code) ⇒ Base
Creates a new postal code to electoral district strategy.
23 24 25 |
# File 'lib/gov_kit-ca/postal_code/strategy/base.rb', line 23 def initialize(postal_code) @postal_code = postal_code end |
Instance Method Details
#electoral_districts ⇒ Array<Fixnum>
Returns the electoral districts within a postal code.
29 30 31 |
# File 'lib/gov_kit-ca/postal_code/strategy/base.rb', line 29 def electoral_districts valid? && electoral_districts!.map(&:to_i).sort end |