Class: Deltacloud::Validation::Param

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



16
17
18
# File 'lib/deltacloud/validation.rb', line 16

def description
  @description
end

#klassObject (readonly)

Returns the value of attribute klass.



16
17
18
# File 'lib/deltacloud/validation.rb', line 16

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/deltacloud/validation.rb', line 16

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



16
17
18
# File 'lib/deltacloud/validation.rb', line 16

def options
  @options
end

#typeObject (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

Returns:

  • (Boolean)


30
31
32
# File 'lib/deltacloud/validation.rb', line 30

def optional?
  type.eql?(:optional)
end

#required?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/deltacloud/validation.rb', line 26

def required?
  type.eql?(:required)
end