Class: Deltacloud::Validation::Param
- Inherits:
-
Object
- Object
- Deltacloud::Validation::Param
- Defined in:
- lib/deltacloud/validation.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(args) ⇒ Param
constructor
A new instance of Param.
- #optional? ⇒ Boolean
- #required? ⇒ Boolean
Constructor Details
#initialize(args) ⇒ Param
Returns a new instance of Param.
18 19 20 21 22 23 24 |
# File 'lib/deltacloud/validation.rb', line 18 def initialize(args) @name = args[0] @klass = args[1] || :string @type = args[2] || :optional @options = args[3] || [] @description = args[4] || '' end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
16 17 18 |
# File 'lib/deltacloud/validation.rb', line 16 def description @description end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
16 17 18 |
# File 'lib/deltacloud/validation.rb', line 16 def klass @klass end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/deltacloud/validation.rb', line 16 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/deltacloud/validation.rb', line 16 def @options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
16 17 18 |
# File 'lib/deltacloud/validation.rb', line 16 def type @type end |
Instance Method Details
#optional? ⇒ Boolean
30 31 32 |
# File 'lib/deltacloud/validation.rb', line 30 def optional? type.eql?(:optional) end |
#required? ⇒ Boolean
26 27 28 |
# File 'lib/deltacloud/validation.rb', line 26 def required? type.eql?(:required) end |