aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/chouette/objectid
diff options
context:
space:
mode:
authorcedricnjanga2017-11-20 15:43:25 +0100
committercedricnjanga2017-11-22 12:49:24 +0100
commit40a5b7409d5214dd8361937c0c9d4726acb53222 (patch)
tree7117a5874ca256cb4ab8654bae8221d8e241372d /app/models/chouette/objectid
parent8295760c9a6e391733cd840bf802651d27bfc197 (diff)
downloadchouette-core-40a5b7409d5214dd8361937c0c9d4726acb53222.tar.bz2
Change the use of namespace and remove modules
Diffstat (limited to 'app/models/chouette/objectid')
-rw-r--r--app/models/chouette/objectid/netex.rb48
-rw-r--r--app/models/chouette/objectid/stif_codifligne.rb14
-rw-r--r--app/models/chouette/objectid/stif_netex.rb20
-rw-r--r--app/models/chouette/objectid/stif_reflex.rb15
4 files changed, 43 insertions, 54 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
diff --git a/app/models/chouette/objectid/stif_codifligne.rb b/app/models/chouette/objectid/stif_codifligne.rb
index c3c19e418..d1a1e7862 100644
--- a/app/models/chouette/objectid/stif_codifligne.rb
+++ b/app/models/chouette/objectid/stif_codifligne.rb
@@ -1,12 +1,10 @@
-module Chouette
- module Objectid
- class StifCodifligne < Chouette::Objectid::Netex
+class Chouette::Objectid::StifCodifligne < Chouette::Objectid::Netex
- attr_accessor :sync_id
- validates_presence_of :sync_id
- validates :creation_id, presence: false
+ attr_accessor :sync_id
+ validates_presence_of :sync_id
+ validates :creation_id, presence: false
- @@format = /^([A-Za-z_]+):([A-Za-z]+):([A-Za-z]+):([0-9A-Za-z_-]+)$/
+ @@format = /^([A-Za-z_]+):([A-Za-z]+):([A-Za-z]+):([0-9A-Za-z_-]+)$/
def initialize(**attributes)
@provider_id = attributes[:provider_id]
@@ -21,4 +19,4 @@ module Chouette
end
end
end
-end
+end \ No newline at end of file
diff --git a/app/models/chouette/objectid/stif_netex.rb b/app/models/chouette/objectid/stif_netex.rb
index 4894daac7..26700bf4b 100644
--- a/app/models/chouette/objectid/stif_netex.rb
+++ b/app/models/chouette/objectid/stif_netex.rb
@@ -1,15 +1,11 @@
-module Chouette
- module Objectid
- class StifNetex < Chouette::Objectid::Netex
+class Chouette::Objectid::StifNetex < Chouette::Objectid::Netex
- def initialize(**attributes)
- @provider_id = (attributes[:provider_id] ||= 'stif')
- super
- end
+ def initialize(**attributes)
+ @provider_id = (attributes[:provider_id] ||= 'stif')
+ super
+ end
- def short_id
- local_id.try(:split, "-").try(:[], -1)
- end
- end
+ def short_id
+ local_id.try(:split, "-").try(:[], -1)
end
-end
+end \ No newline at end of file
diff --git a/app/models/chouette/objectid/stif_reflex.rb b/app/models/chouette/objectid/stif_reflex.rb
index 711308541..6ffaf7c0e 100644
--- a/app/models/chouette/objectid/stif_reflex.rb
+++ b/app/models/chouette/objectid/stif_reflex.rb
@@ -1,12 +1,10 @@
-module Chouette
- module Objectid
- class StifReflex < Chouette::Objectid::Netex
+class Chouette::Objectid::StifReflex < Chouette::Objectid::Netex
- attr_accessor :country_code, :zip_code
- validates_presence_of :country_code, :zip_code
- validates :creation_id, presence: false
+ attr_accessor :country_code, :zip_code
+ validates_presence_of :country_code, :zip_code
+ validates :creation_id, presence: false
- @@format = /^([A-Za-z_]+):([0-9A-Za-z_-]+):([A-Za-z]+):([0-9A-Za-z_-]+):([A-Za-z]+)$/
+ @@format = /^([A-Za-z_]+):([0-9A-Za-z_-]+):([A-Za-z]+):([0-9A-Za-z_-]+):([A-Za-z]+)$/
def initialize(**attributes)
@provider_id = attributes[:provider_id]
@@ -20,4 +18,5 @@ module Chouette
end
end
end
-end
+
+end \ No newline at end of file