aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/objectid/netex.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/chouette/objectid/netex.rb')
-rw-r--r--app/models/chouette/objectid/netex.rb48
1 files changed, 22 insertions, 26 deletions
diff --git a/app/models/chouette/objectid/netex.rb b/app/models/chouette/objectid/netex.rb
index 0013de7c8..b83ef7b8d 100644
--- a/app/models/chouette/objectid/netex.rb
+++ b/app/models/chouette/objectid/netex.rb
@@ -1,33 +1,29 @@
-module Chouette
- module Objectid
- class Netex
- include ActiveModel::Model
+class Chouette::Objectid::Netex
+ include ActiveModel::Model
- attr_accessor :provider_id, :object_type, :local_id, :creation_id
- validates_presence_of :provider_id, :object_type, :local_id, :creation_id
- validate :must_respect_format
+ attr_accessor :provider_id, :object_type, :local_id, :creation_id
+ validates_presence_of :provider_id, :object_type, :local_id, :creation_id
+ validate :must_respect_format
- def initialize(**attributes)
- @provider_id ||= (attributes[:provider_id] ||= 'chouette')
- @object_type = attributes[:object_type]
- @local_id = attributes[:local_id]
- @creation_id = (attributes[:creation_id] ||= 'LOC')
- end
+ def initialize(**attributes)
+ @provider_id ||= (attributes[:provider_id] ||= 'chouette')
+ @object_type = attributes[:object_type]
+ @local_id = attributes[:local_id]
+ @creation_id = (attributes[:creation_id] ||= 'LOC')
+ end
- @@format = /^([A-Za-z_-]+):([A-Za-z]+):([0-9A-Za-z_-]+):([A-Za-z]+)$/
- cattr_reader :format
+ @@format = /^([A-Za-z_-]+):([A-Za-z]+):([0-9A-Za-z_-]+):([A-Za-z]+)$/
+ cattr_reader :format
- def to_s
- "#{self.provider_id}:#{self.object_type}:#{self.local_id}:#{self.creation_id}"
- end
+ def to_s
+ "#{self.provider_id}:#{self.object_type}:#{self.local_id}:#{self.creation_id}"
+ end
- def must_respect_format
- self.to_s.match(format)
- end
+ def must_respect_format
+ self.to_s.match(format)
+ end
- def short_id
- local_id
- end
- end
+ def short_id
+ local_id
end
-end
+end \ No newline at end of file