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.



36
37
38
39
40
41
42
# File 'lib/deltacloud/validation.rb', line 36

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.



34
35
36
# File 'lib/deltacloud/validation.rb', line 34

def description
  @description
end

#klassObject (readonly)

Returns the value of attribute klass.



34
35
36
# File 'lib/deltacloud/validation.rb', line 34

def klass
  @klass
end

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/deltacloud/validation.rb', line 34

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



34
35
36
# File 'lib/deltacloud/validation.rb', line 34

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



34
35
36
# File 'lib/deltacloud/validation.rb', line 34

def type
  @type
end

Instance Method Details

#optional?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/deltacloud/validation.rb', line 48

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

#required?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/deltacloud/validation.rb', line 44

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