Class: DipValidator::Validator
- Inherits:
-
Object
- Object
- DipValidator::Validator
- Includes:
- ActiveModel::Model
- Defined in:
- lib/dip_validator/validator.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#created ⇒ Object
Returns the value of attribute created.
-
#dip ⇒ Object
Returns the value of attribute dip.
-
#discussions_to ⇒ Object
replace - with _.
-
#implementation ⇒ Object
Returns the value of attribute implementation.
-
#layer ⇒ Object
Returns the value of attribute layer.
-
#replaces ⇒ Object
Returns the value of attribute replaces.
-
#requires ⇒ Object
Returns the value of attribute requires.
-
#resolution ⇒ Object
Returns the value of attribute resolution.
-
#review_period_end ⇒ Object
replace - with _.
-
#status ⇒ Object
Returns the value of attribute status.
-
#superseded_by ⇒ Object
replace - with _.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updated ⇒ Object
Returns the value of attribute updated.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Validator
constructor
A new instance of Validator.
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
#author ⇒ Object
Returns the value of attribute author.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def @author end |
#created ⇒ Object
Returns the value of attribute created.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def created @created end |
#dip ⇒ Object
Returns the value of attribute dip.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def dip @dip end |
#discussions_to ⇒ Object
replace - with _
22 23 24 |
# File 'lib/dip_validator/validator.rb', line 22 def discussions_to @discussions_to end |
#implementation ⇒ Object
Returns the value of attribute implementation.
20 21 22 |
# File 'lib/dip_validator/validator.rb', line 20 def implementation @implementation end |
#layer ⇒ Object
Returns the value of attribute layer.
20 21 22 |
# File 'lib/dip_validator/validator.rb', line 20 def layer @layer end |
#replaces ⇒ Object
Returns the value of attribute replaces.
20 21 22 |
# File 'lib/dip_validator/validator.rb', line 20 def replaces @replaces end |
#requires ⇒ Object
Returns the value of attribute requires.
20 21 22 |
# File 'lib/dip_validator/validator.rb', line 20 def requires @requires end |
#resolution ⇒ Object
Returns the value of attribute resolution.
20 21 22 |
# File 'lib/dip_validator/validator.rb', line 20 def resolution @resolution end |
#review_period_end ⇒ Object
replace - with _
22 23 24 |
# File 'lib/dip_validator/validator.rb', line 22 def review_period_end @review_period_end end |
#status ⇒ Object
Returns the value of attribute status.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def status @status end |
#superseded_by ⇒ Object
replace - with _
22 23 24 |
# File 'lib/dip_validator/validator.rb', line 22 def superseded_by @superseded_by end |
#title ⇒ Object
Returns the value of attribute title.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def title @title end |
#updated ⇒ Object
Returns the value of attribute updated.
19 20 21 |
# File 'lib/dip_validator/validator.rb', line 19 def updated @updated end |