Class: DMap::Validations::Length
- Inherits:
-
Object
- Object
- DMap::Validations::Length
- Defined in:
- lib/dmap/validations/length.rb
Overview
Only need the property tag when the validation attaches itself to the property
Instance Attribute Summary collapse
-
#property ⇒ Object
Returns the value of attribute property.
Class Method Summary collapse
-
.is_valid?(command = nil) ⇒ Boolean
Return true if it’s valid.
- .property ⇒ Object
- .validate(command = nil) ⇒ Object
Instance Attribute Details
#property ⇒ Object
Returns the value of attribute property.
5 6 7 |
# File 'lib/dmap/validations/length.rb', line 5 def property @property end |
Class Method Details
.is_valid?(command = nil) ⇒ Boolean
Return true if it’s valid
10 11 12 13 |
# File 'lib/dmap/validations/length.rb', line 10 def self.is_valid?(command=nil) command ||= "" !(command.match(/^\d+$/) or command.match(/^\d+\.\.\d+$/)).nil? end |
.property ⇒ Object
7 |
# File 'lib/dmap/validations/length.rb', line 7 def self.property; true; end |
.validate(command = nil) ⇒ Object
15 16 17 18 |
# File 'lib/dmap/validations/length.rb', line 15 def self.validate(command=nil) command ||= "" DMap::Validations::Core::Numbers.run command end |