Class: GTFS::Meta::Feed

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/gtfs/meta/models/feed.rb

Instance Method Summary collapse

Instance Method Details

#source_file_nameObject



22
23
24
# File 'lib/gtfs/meta/models/feed.rb', line 22

def source_file_name
  source_url.split("/").last
end

#source_host_nameObject



18
19
20
# File 'lib/gtfs/meta/models/feed.rb', line 18

def source_host_name
  URI(source_url).hostname.split(".").reverse[1]
end

#source_zipness_validatorObject



14
15
16
# File 'lib/gtfs/meta/models/feed.rb', line 14

def source_zipness_validator
  errors.add(:source_url, "is not a zip") unless (source_url && source_file_name.ends_with?(".zip"))
end