Class: Structish::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/structish/validation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, conditions, constructor) ⇒ Validation

Returns a new instance of Validation.



6
7
8
9
10
# File 'lib/structish/validation.rb', line 6

def initialize(value, conditions, constructor)
  @value = value
  @conditions = conditions
  @constructor = constructor
end

Instance Attribute Details

#conditionsObject (readonly)

Returns the value of attribute conditions.



4
5
6
# File 'lib/structish/validation.rb', line 4

def conditions
  @conditions
end

#constructorObject (readonly)

Returns the value of attribute constructor.



4
5
6
# File 'lib/structish/validation.rb', line 4

def constructor
  @constructor
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/structish/validation.rb', line 4

def value
  @value
end

Instance Method Details

#validateObject

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/structish/validation.rb', line 12

def validate
  raise(NotImplementedError, "Validation conditions function must be defined")
end