Class: Aws::Resources::Validator::Context

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Context

Returns a new instance of Context


6
7
8
9
10
11
12
13
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 6

def initialize(options = {})
  @parent = options[:parent]
  @path = options[:path]
  @value = options[:value]
  @definition = options[:definition]
  @api = options[:api]
  @errors = options[:errors] || []
end

Instance Attribute Details

#apiHash (readonly)

Returns:

  • (Hash)

39
40
41
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 39

def api
  @api
end

#definitionHash (readonly)

Returns:

  • (Hash)

36
37
38
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 36

def definition
  @definition
end

#errorsArray<String> (readonly)

Returns:

  • (Array<String>)

42
43
44
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 42

def errors
  @errors
end

#parentContext? (readonly)

Returns:


27
28
29
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 27

def parent
  @parent
end

#pathString (readonly)

Returns:

  • (String)

30
31
32
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 30

def path
  @path
end

#valueObject (readonly)

Returns:

  • (Object)

33
34
35
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 33

def value
  @value
end

Instance Method Details

#[](key) ⇒ Object


44
45
46
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 44

def [] key
  @value[key]
end

#child(at) ⇒ Object


15
16
17
18
19
20
21
22
23
24
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 15

def child(at)
  Context.new(
    parent: self,
    path: "#{path}/#{at}",
    value: value[at],
    definition: definition,
    api: api,
    errors: errors
  )
end

#error(msg) ⇒ Object


48
49
50
51
# File 'aws-sdk-resources/lib/aws-sdk-resources/validator/context.rb', line 48

def error(msg)
  @errors << msg
  false
end