Class: AipValidator::Validator
- Inherits:
-
Object
- Object
- AipValidator::Validator
- Includes:
- ActiveModel::Model
- Defined in:
- lib/aip_validator/validator.rb
Instance Attribute Summary collapse
-
#aip ⇒ Object
Returns the value of attribute aip.
-
#author ⇒ Object
Returns the value of attribute author.
-
#category ⇒ Object
Returns the value of attribute category.
-
#created ⇒ Object
Returns the value of attribute created.
-
#discussions_to ⇒ Object
replace - with _.
-
#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.
-
#type ⇒ Object
Returns the value of attribute type.
-
#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/aip_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
#aip ⇒ Object
Returns the value of attribute aip.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def aip @aip end |
#author ⇒ Object
Returns the value of attribute author.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def @author end |
#category ⇒ Object
Returns the value of attribute category.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def category @category end |
#created ⇒ Object
Returns the value of attribute created.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def created @created end |
#discussions_to ⇒ Object
replace - with _
22 23 24 |
# File 'lib/aip_validator/validator.rb', line 22 def discussions_to @discussions_to end |
#layer ⇒ Object
Returns the value of attribute layer.
20 21 22 |
# File 'lib/aip_validator/validator.rb', line 20 def layer @layer end |
#replaces ⇒ Object
Returns the value of attribute replaces.
20 21 22 |
# File 'lib/aip_validator/validator.rb', line 20 def replaces @replaces end |
#requires ⇒ Object
Returns the value of attribute requires.
20 21 22 |
# File 'lib/aip_validator/validator.rb', line 20 def requires @requires end |
#resolution ⇒ Object
Returns the value of attribute resolution.
20 21 22 |
# File 'lib/aip_validator/validator.rb', line 20 def resolution @resolution end |
#review_period_end ⇒ Object
replace - with _
22 23 24 |
# File 'lib/aip_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/aip_validator/validator.rb', line 19 def status @status end |
#superseded_by ⇒ Object
replace - with _
22 23 24 |
# File 'lib/aip_validator/validator.rb', line 22 def superseded_by @superseded_by end |
#title ⇒ Object
Returns the value of attribute title.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def title @title end |
#type ⇒ Object
Returns the value of attribute type.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def type @type end |
#updated ⇒ Object
Returns the value of attribute updated.
19 20 21 |
# File 'lib/aip_validator/validator.rb', line 19 def updated @updated end |