Class: DMap::Validations::Length

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Attribute Details

#propertyObject

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

Returns:

  • (Boolean)


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

.propertyObject



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