Module: MySociety::MapIt::LocalAuthorityFinder
Constant Summary collapse
- LOCAL_AUTHORITY_TYPE_CODES =
%w( DIS MTD UTA LBO CTY LGD COI ).map { |c| c.freeze }.freeze
Instance Method Summary collapse
Instance Method Details
#local_authority ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/my_society/map_it.rb', line 25 def = to_point.to_hash.values.sort_by { |a| LOCAL_AUTHORITY_TYPE_CODES.index(a['type']) || -1 }.detect do |la| LOCAL_AUTHORITY_TYPE_CODES.include? la['type'] end return if .nil? LocalAuthority.new rescue nil end |