diff options
| author | Robert | 2017-10-02 08:53:18 +0200 |
|---|---|---|
| committer | Robert | 2017-10-02 10:52:07 +0200 |
| commit | 30bdfe7c5557ba85f2c6cb18abe4b0308faa217d (patch) | |
| tree | 2b5c36dced85c09fbfed1bf53a5da827862ee4e6 /app/models/generic_attribute_control | |
| parent | 1bc4ab6684803a3974bd65f6531bd43a57c15fd0 (diff) | |
| download | chouette-core-30bdfe7c5557ba85f2c6cb18abe4b0308faa217d.tar.bz2 | |
Fixes: #4627@0.55h;
Class Methods replace Class Attributes
Diffstat (limited to 'app/models/generic_attribute_control')
| -rw-r--r-- | app/models/generic_attribute_control/min_max.rb | 11 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/pattern.rb | 9 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/uniqueness.rb | 9 |
3 files changed, 16 insertions, 13 deletions
diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb index d18ff6344..0b0e5a9a7 100644 --- a/app/models/generic_attribute_control/min_max.rb +++ b/app/models/generic_attribute_control/min_max.rb @@ -2,17 +2,18 @@ module GenericAttributeControl class MinMax < ComplianceControl hstore_accessor :control_attributes, minimum: :integer, maximum: :integer - cattr_reader :default_criticity, :default_code - @@default_criticity = :warning - @@default_code = "3-Generic-2" validate :min_max_values def min_max_values true end - def self.dynamic_attributes - self.hstore_metadata_for_control_attributes.keys + class << self + def default_criticity; :warning end + def default_code; "3-Generic-2" end + def dynamic_attributes + hstore_metadata_for_control_attributes.keys + end end end end diff --git a/app/models/generic_attribute_control/pattern.rb b/app/models/generic_attribute_control/pattern.rb index 9e5a311de..72bb1770a 100644 --- a/app/models/generic_attribute_control/pattern.rb +++ b/app/models/generic_attribute_control/pattern.rb @@ -2,13 +2,14 @@ module GenericAttributeControl class Pattern < ComplianceControl hstore_accessor :control_attributes, value: :string, pattern: :string - cattr_reader :default_criticity, :default_code - @@default_criticity = :warning - @@default_code = "3-Generic-3" - validate :pattern_match def pattern_match true end + + class << self + def default_criticity; :warning end + def default_code; "3-Generic-3" end + end end end diff --git a/app/models/generic_attribute_control/uniqueness.rb b/app/models/generic_attribute_control/uniqueness.rb index 3efe1deac..6ffe78565 100644 --- a/app/models/generic_attribute_control/uniqueness.rb +++ b/app/models/generic_attribute_control/uniqueness.rb @@ -2,13 +2,14 @@ module GenericAttributeControl class Uniqueness < ComplianceControl hstore_accessor :control_attributes, name: :string - cattr_reader :default_criticity, :default_code - @@default_criticity = :warning - @@default_code = "3-Generic-3" - validate :unique_values def unique_values true end + + class << self + def default_criticity; :warning end + def default_code; "3-Generic-3" end + end end end |
