Parent

Class/Module Index [+]

Quicksearch

Deltacloud::Validation::Param

Attributes

description[R]
klass[R]
name[R]
options[R]
type[R]

Public Class Methods

new(args) click to toggle source
# File lib/deltacloud/validation.rb, line 33
def initialize(args)
  @name = args[0]
  @klass = args[1] || :string
  @type = args[2] || :optional
  @options = args[3] || []
  @description = args[4] || ''
end

Public Instance Methods

hwp_property?() click to toggle source
# File lib/deltacloud/validation.rb, line 58
def hwp_property?
  true if name.to_s =~ /^hwp_(cpu|memory|storage|architecture)/
end
optional?() click to toggle source
# File lib/deltacloud/validation.rb, line 45
def optional?
  type.eql?(:optional)
end
required?() click to toggle source
# File lib/deltacloud/validation.rb, line 41
def required?
  type.eql?(:required)
end
valid_hwp_value?(profile, value) click to toggle source
# File lib/deltacloud/validation.rb, line 54
def valid_hwp_value?(profile, value)
  profile.property(@name.to_s.gsub(/^hwp_/, '')).valid?(value)
end
valid_value?(value) click to toggle source
# File lib/deltacloud/validation.rb, line 49
def valid_value?(value)
  true if (options.kind_of?(Range) or options.kind_of?(Array)) and options.include?(value)
  true if options.kind_of?(String) and not options.empty?
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.