diff options
| author | Zakaria BOUZIANE | 2015-03-10 11:48:45 +0100 |
|---|---|---|
| committer | Zakaria BOUZIANE | 2015-03-10 11:48:45 +0100 |
| commit | 8d9281dcc994ad76092b4878b26801507915f16a (patch) | |
| tree | f251279852dc6cf982459df501540585966e0478 /lib | |
| parent | 05fb2b7aa8ca7d490a8960a096de7d934fffe133 (diff) | |
| download | chouette-core-8d9281dcc994ad76092b4878b26801507915f16a.tar.bz2 | |
Merging intermediate state
Diffstat (limited to 'lib')
10 files changed, 27 insertions, 27 deletions
diff --git a/lib/ninoxe_extension/hub/company_restrictions.rb b/lib/ninoxe_extension/hub/company_restrictions.rb index 780e0e4d9..dd3f5efdf 100644 --- a/lib/ninoxe_extension/hub/company_restrictions.rb +++ b/lib/ninoxe_extension/hub/company_restrictions.rb @@ -7,11 +7,11 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |g| # HUB-7 - g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,3}$} + g.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,3}\z} # HUB-8 - g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + g.validates_format_of :name, :with => %r{\A[\w]{1,75}\z} # HUB-9 - g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_format_of :registration_number, :with => %r{\A[\d]{1,8}\z} g.validates_uniqueness_of :registration_number end end diff --git a/lib/ninoxe_extension/hub/group_of_line_restrictions.rb b/lib/ninoxe_extension/hub/group_of_line_restrictions.rb index 13688376f..a386bb8ad 100644 --- a/lib/ninoxe_extension/hub/group_of_line_restrictions.rb +++ b/lib/ninoxe_extension/hub/group_of_line_restrictions.rb @@ -8,11 +8,11 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |g| # HUB-11 - g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,6}$} + g.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,6}\z} # HUB-12 - g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + g.validates_format_of :name, :with => %r{\A[\w]{1,75}\z} # HUB-13 - g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_format_of :registration_number, :with => %r{\A[\d]{1,8}\z} g.validates_uniqueness_of :registration_number end end diff --git a/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb b/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb index 2726c563a..f5e04d5bb 100644 --- a/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb +++ b/lib/ninoxe_extension/hub/journey_pattern_restrictions.rb @@ -8,11 +8,11 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |jp| # HUB-39 - jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,30}$} + jp.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,30}\z} # HUB-40 jp.validates :registration_number, :numericality => { :less_than => 10 ** 8 } # HUB-41 - jp.validates_format_of :name, :with => %r{^[\w]{0,75}$} + jp.validates_format_of :name, :with => %r{\A[\w]{0,75}\z} end end end diff --git a/lib/ninoxe_extension/hub/line_restrictions.rb b/lib/ninoxe_extension/hub/line_restrictions.rb index 119ab07b6..03dbf675a 100644 --- a/lib/ninoxe_extension/hub/line_restrictions.rb +++ b/lib/ninoxe_extension/hub/line_restrictions.rb @@ -9,11 +9,11 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |l| # HUB-15 - l.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,14}$} + l.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,14}\z} # HUB-16 - l.validates_format_of :number, :with => %r{^[\w]{1,6}$} + l.validates_format_of :number, :with => %r{\A[\w]{1,6}\z} # HUB-17 - l.validates_format_of :name, :with => %r{^[\w]{0,75}$} + l.validates_format_of :name, :with => %r{\A[\w]{0,75}\z} # HUB-21 l.validates :registration_number, :numericality => { :less_than => 10 ** 8 } # HUB-22 diff --git a/lib/ninoxe_extension/hub/network_restrictions.rb b/lib/ninoxe_extension/hub/network_restrictions.rb index b2e8d4be5..58de2e8ab 100644 --- a/lib/ninoxe_extension/hub/network_restrictions.rb +++ b/lib/ninoxe_extension/hub/network_restrictions.rb @@ -7,11 +7,11 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |g| # HUB-3 - g.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,3}$} + g.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,3}\z} # HUB-4 - g.validates_format_of :name, :with => %r{^[\w]{1,75}$} + g.validates_format_of :name, :with => %r{\A[\w]{1,75}\z} # HUB-5 - g.validates_format_of :registration_number, :with => %r{^[\d]{1,8}$} + g.validates_format_of :registration_number, :with => %r{\A[\d]{1,8}\z} g.validates_uniqueness_of :registration_number end end diff --git a/lib/ninoxe_extension/hub/objectid_restrictions.rb b/lib/ninoxe_extension/hub/objectid_restrictions.rb index 675994359..6f8608b49 100644 --- a/lib/ninoxe_extension/hub/objectid_restrictions.rb +++ b/lib/ninoxe_extension/hub/objectid_restrictions.rb @@ -7,7 +7,7 @@ module NinoxeExtension::Hub::ObjectidRestrictions validate :third_part_objectid_uniqueness def third_part_objectid - self.objectid.match(/:(\w+)$/)[1] + self.objectid.match(/:(\w+)\z/)[1] end def third_part_objectid_uniqueness return unless hub_restricted? diff --git a/lib/ninoxe_extension/hub/route_restrictions.rb b/lib/ninoxe_extension/hub/route_restrictions.rb index a5f4c8019..538995dc8 100644 --- a/lib/ninoxe_extension/hub/route_restrictions.rb +++ b/lib/ninoxe_extension/hub/route_restrictions.rb @@ -21,7 +21,7 @@ module NinoxeExtension::Hub # HUB-38 with_options if: :hub_restricted? do |route| - route.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,8}$} + route.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,8}\z} end end end diff --git a/lib/ninoxe_extension/hub/stop_area_restrictions.rb b/lib/ninoxe_extension/hub/stop_area_restrictions.rb index f09510cc4..71b2b6323 100644 --- a/lib/ninoxe_extension/hub/stop_area_restrictions.rb +++ b/lib/ninoxe_extension/hub/stop_area_restrictions.rb @@ -24,28 +24,28 @@ module NinoxeExtension::Hub with_options if: commercial_and_physical_hub_restricted? do |sa| # HUB-23 - sa.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,12}$} - sa.validates_format_of :name, :with => %r{^[\w]{1,75}$} + sa.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,12}\z} + sa.validates_format_of :name, :with => %r{\A[\w]{1,75}\z} end with_options if: commercial_hub_restricted? do |sa| # HUB-24 - validates_format_of :nearest_topic_name, :with => %r{^[\w]{0,255}$} + validates_format_of :nearest_topic_name, :with => %r{\A[\w]{0,255}\z} end with_options if: physical_hub_restricted? do |sa| # HUB-25 - sa.validates_format_of :nearest_topic_name, :with => %r{^[\w]{0,60}$} + sa.validates_format_of :nearest_topic_name, :with => %r{\A[\w]{0,60}\z} # HUB-28 sa.validates_presence_of :longitude sa.validates_presence_of :latitude # HUB-29 - sa.validates_format_of :city_name, :with => %r{^[\w]{1,80}$} + sa.validates_format_of :city_name, :with => %r{\A[\w]{1,80}\z} # HUB-30 - sa.validates_format_of :zip_code, :with => %r{^[\d]{5}$} + sa.validates_format_of :zip_code, :with => %r{\A[\d]{5}\z} # HUB-31 - sa.validates_format_of :comment, :with => %r{^[\w]{0,255}$} + sa.validates_format_of :comment, :with => %r{\A[\w]{0,255}\z} # HUB-32 - sa.validates_format_of :registration_number, :with => %r{^[\w]{1,8}$}, :allow_blank => true, :allow_nil => true + sa.validates_format_of :registration_number, :with => %r{\A[\w]{1,8}\z}, :allow_blank => true, :allow_nil => true end end end diff --git a/lib/ninoxe_extension/hub/time_table_restrictions.rb b/lib/ninoxe_extension/hub/time_table_restrictions.rb index 6f2984dda..e771c296a 100644 --- a/lib/ninoxe_extension/hub/time_table_restrictions.rb +++ b/lib/ninoxe_extension/hub/time_table_restrictions.rb @@ -8,9 +8,9 @@ module NinoxeExtension::Hub with_options if: :hub_restricted? do |jp| # HUB-44 - jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,6}$} + jp.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,6}\z} # HUB-45 - jp.validates_format_of :comment, :with => %r{^[\w]{0,75}$} + jp.validates_format_of :comment, :with => %r{\A[\w]{0,75}\z} end end end diff --git a/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb b/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb index 81a023dca..68112fc8f 100644 --- a/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb +++ b/lib/ninoxe_extension/hub/vehicle_journey_restrictions.rb @@ -8,7 +8,7 @@ module NinoxeExtension::Hub # HUB-42 with_options if: :hub_restricted? do |jp| - jp.validates_format_of :objectid, :with => %r{^\w+:\w+:[\w]{1,8}$} + jp.validates_format_of :objectid, :with => %r{\A\w+:\w+:[\w]{1,8}\z} end end end |
