Class: Chef::Attribute::Validator::Check

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-attribute-validator/check.rb,
lib/chef-attribute-validator/checks/enum.rb,
lib/chef-attribute-validator/checks/proc.rb,
lib/chef-attribute-validator/checks/type.rb,
lib/chef-attribute-validator/checks/regex.rb,
lib/chef-attribute-validator/checks/present.rb,
lib/chef-attribute-validator/checks/required.rb,
lib/chef-attribute-validator/checks/child_keys.rb,
lib/chef-attribute-validator/checks/looks_like.rb,
lib/chef-attribute-validator/checks/max_children.rb,
lib/chef-attribute-validator/checks/min_children.rb

Defined Under Namespace

Classes: ChildKeys, Enum, LooksLike, MaxChildren, MinChildren, Present, Proc, Regex, Required, Type

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(a_rule, a_check_arg) ⇒ Check

Returns a new instance of Check.



9
10
11
12
13
# File 'lib/chef-attribute-validator/check.rb', line 9

def initialize(a_rule, a_check_arg)
  @path_spec = a_rule.path
  @rule_name = a_rule.name
  @check_arg = a_check_arg
end

Instance Attribute Details

#check_argObject

Returns the value of attribute check_arg.



6
7
8
# File 'lib/chef-attribute-validator/check.rb', line 6

def check_arg
  @check_arg
end

#path_specObject

Returns the value of attribute path_spec.



5
6
7
# File 'lib/chef-attribute-validator/check.rb', line 5

def path_spec
  @path_spec
end

#rule_nameObject

Returns the value of attribute rule_name.



7
8
9
# File 'lib/chef-attribute-validator/check.rb', line 7

def rule_name
  @rule_name
end

Class Method Details

.list_check_typesObject



24
25
26
# File 'lib/chef-attribute-validator/check.rb', line 24

def self.list_check_types
  @@check_classes.keys
end

.make(check_name, a_rule, a_check_arg) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/chef-attribute-validator/check.rb', line 15

def self.make(check_name, a_rule, a_check_arg)
  unless @@check_classes.has_key?(check_name)
    raise "Unrecognized option or check type '#{check_name}' for attribute validation rule '#{a_rule.name}'"
  end
  checker = @@check_classes[check_name].new(a_rule, a_check_arg)
  checker.validate_check_arg
  checker
end