class Aws::Templates::Utils::Default::Definition

Abstract defaults definition

Defaults definition is an object wrapper which enables definition merging. It also contains factory method to transform arbitrary objects into Definition object and defines basic functionality.

Public Class Methods

empty() click to toggle source
# File lib/aws/templates/utils/default.rb, line 194
def empty
  Empty.instance
end
from(obj) click to toggle source
# File lib/aws/templates/utils/default.rb, line 198
def from(obj)
  return obj if obj.is_a? Definition
  return Scalar.new(obj) if obj.override?
  return Scheme.new(obj) if Utils.recursive?(obj)
  return Calculable.new(obj) if obj.respond_to?(:to_proc)

  raise "Invalid object #{obj}"
end

Public Instance Methods

for(_) click to toggle source
# File lib/aws/templates/utils/default.rb, line 214
def for(_)
  raise 'Must be overriden'
end
merge(b) click to toggle source
# File lib/aws/templates/utils/default.rb, line 208
def merge(b)
  return b if b.override?
  return self if b == Definition.empty
  Pair[self, b]
end
override?() click to toggle source
# File lib/aws/templates/utils/default.rb, line 222
def override?
  false
end
to_definition() click to toggle source
# File lib/aws/templates/utils/default.rb, line 218
def to_definition
  self
end