Class: Object

Inherits:
BasicObject
Defined in:
lib/aws/templates/utils/dependency/object.rb

Overview

Dependency method stubs

To avoid checking classes directly to filter out dependencies and non-dependencies, we’re monkey-patching Object class with stubs for Dependency class.

TODO: Devise a better approach and remove the extension

Constant Summary collapse

EMPTY_SET =
Set.new.freeze

Instance Method Summary collapse

Instance Method Details

#as_a_dependencyObject

mark the object as dependency



38
39
40
# File 'lib/aws/templates/utils/dependency/object.rb', line 38

def as_a_dependency
  Aws::Templates::Utils::Dependency.new(object)
end

#as_a_self_dependencyObject

mark the object as dependency of itself



43
44
45
# File 'lib/aws/templates/utils/dependency/object.rb', line 43

def as_a_self_dependency
  as_a_dependency.to_self
end

#dependenciesObject

it returns a set containing a single dependency on itself



33
34
35
# File 'lib/aws/templates/utils/dependency/object.rb', line 33

def dependencies
  EMPTY_SET
end

#dependency?Boolean

By default an object is not a dependency

Returns:

  • (Boolean)


15
16
17
# File 'lib/aws/templates/utils/dependency/object.rb', line 15

def dependency?
  false
end

#objectObject Also known as: not_a_dependency

It returns self



20
21
22
# File 'lib/aws/templates/utils/dependency/object.rb', line 20

def object
  self
end

#rootObject

Object root

It is used to gracefully process dependencies



28
# File 'lib/aws/templates/utils/dependency/object.rb', line 28

def root; end