Class: DipValidator::Validator

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/dip_validator/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Validator

Returns a new instance of Validator.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/dip_validator/validator.rb', line 5

def initialize(opts = {})
  # ruby does not allow method with -
  # replaces - with _
  opts.keys.each do |key|
    raise("#{key} incude _ which is not allowed") if key.to_s.match(/_/)
    if key.to_s.match(/-/)
      new_key = opts.keys.last.to_s.gsub('-','_')
      opts[new_key] = opts.delete key
    end
  end
  super(opts)
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def author
  @author
end

#createdObject

Returns the value of attribute created.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def created
  @created
end

#dipObject

Returns the value of attribute dip.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def dip
  @dip
end

#discussions_toObject

replace - with _



22
23
24
# File 'lib/dip_validator/validator.rb', line 22

def discussions_to
  @discussions_to
end

#implementationObject

Returns the value of attribute implementation.



20
21
22
# File 'lib/dip_validator/validator.rb', line 20

def implementation
  @implementation
end

#layerObject

Returns the value of attribute layer.



20
21
22
# File 'lib/dip_validator/validator.rb', line 20

def layer
  @layer
end

#replacesObject

Returns the value of attribute replaces.



20
21
22
# File 'lib/dip_validator/validator.rb', line 20

def replaces
  @replaces
end

#requiresObject

Returns the value of attribute requires.



20
21
22
# File 'lib/dip_validator/validator.rb', line 20

def requires
  @requires
end

#resolutionObject

Returns the value of attribute resolution.



20
21
22
# File 'lib/dip_validator/validator.rb', line 20

def resolution
  @resolution
end

#review_period_endObject

replace - with _



22
23
24
# File 'lib/dip_validator/validator.rb', line 22

def review_period_end
  @review_period_end
end

#statusObject

Returns the value of attribute status.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def status
  @status
end

#superseded_byObject

replace - with _



22
23
24
# File 'lib/dip_validator/validator.rb', line 22

def superseded_by
  @superseded_by
end

#titleObject

Returns the value of attribute title.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def title
  @title
end

#updatedObject

Returns the value of attribute updated.



19
20
21
# File 'lib/dip_validator/validator.rb', line 19

def updated
  @updated
end