diff options
| author | cedricnjanga | 2017-09-27 12:28:23 +0200 |
|---|---|---|
| committer | cedricnjanga | 2017-09-27 16:15:13 +0200 |
| commit | ea0cf8c5e11ddbd61eed8cd825ac923ad947cdf4 (patch) | |
| tree | 0da9a75100a96bb886003baaf31287786c2a8f17 /app/models/generic_attribute_control | |
| parent | 86abe568ce4c04d14df882ece44576ff069c4a3c (diff) | |
| download | chouette-core-ea0cf8c5e11ddbd61eed8cd825ac923ad947cdf4.tar.bz2 | |
Refs #4616 put generic_attribute compliance control inside a folder
Diffstat (limited to 'app/models/generic_attribute_control')
| -rw-r--r-- | app/models/generic_attribute_control/min_max.rb | 17 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/pattern.rb | 13 | ||||
| -rw-r--r-- | app/models/generic_attribute_control/uniqueness.rb | 13 |
3 files changed, 43 insertions, 0 deletions
diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb new file mode 100644 index 000000000..6a2e1f284 --- /dev/null +++ b/app/models/generic_attribute_control/min_max.rb @@ -0,0 +1,17 @@ +module GenericAttributeControl + class MinMax < ComplianceControl + hstore_accessor :control_attributes, minimum: :integer, maximum: :integer + + @@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 + end + end +end diff --git a/app/models/generic_attribute_control/pattern.rb b/app/models/generic_attribute_control/pattern.rb new file mode 100644 index 000000000..5b27da54e --- /dev/null +++ b/app/models/generic_attribute_control/pattern.rb @@ -0,0 +1,13 @@ +module GenericAttributeControl + class Pattern < ComplianceControl + hstore_accessor :control_attributes, value: :string, pattern: :string + + @@default_criticity = :warning + @@default_code = "3-Generic-3" + + validate :pattern_match + def pattern_match + true + end + end +end
\ No newline at end of file diff --git a/app/models/generic_attribute_control/uniqueness.rb b/app/models/generic_attribute_control/uniqueness.rb new file mode 100644 index 000000000..4f1a82083 --- /dev/null +++ b/app/models/generic_attribute_control/uniqueness.rb @@ -0,0 +1,13 @@ +module GenericAttributeControl + class Uniqueness < ComplianceControl + hstore_accessor :control_attributes, name: :string + + @@default_criticity = :warning + @@default_code = "3-Generic-3" + + validate :unique_values + def unique_values + true + end + end +end
\ No newline at end of file |
