Class: CfnDsl::Fn

Inherits:
JSONable show all
Defined in:
lib/cfndsl/jsonable.rb

Overview

Handles all of the Fn

objects

Constant Summary

Constants included from Functions

CfnDsl::Functions::FN_SUB_SCANNER

Instance Method Summary collapse

Methods inherited from JSONable

#declare, #external_parameters, external_parameters

Methods included from Functions

#FnAnd, #FnBase64, #FnCidr, #FnEquals, #FnFindInMap, #FnGetAZs, #FnGetAtt, #FnIf, #FnImportValue, #FnJoin, #FnNot, #FnOr, #FnSelect, #FnSplit, #FnSub, #Ref

Methods included from RefCheck

#build_references

Constructor Details

#initialize(function, argument, refs = [], condition_refs = []) ⇒ Fn

Returns a new instance of Fn.



184
185
186
187
188
189
# File 'lib/cfndsl/jsonable.rb', line 184

def initialize(function, argument, refs = [], condition_refs = [])
  @function = function
  @argument = argument
  @_refs = refs
  @_condition_refs = condition_refs
end

Instance Method Details

#all_refsObject



201
202
203
# File 'lib/cfndsl/jsonable.rb', line 201

def all_refs
  @_refs
end

#as_json(_options = {}) ⇒ Object



191
192
193
194
195
# File 'lib/cfndsl/jsonable.rb', line 191

def as_json(_options = {})
  hash = {}
  hash["Fn::#{@function}"] = @argument
  hash
end

#condition_refsObject



205
206
207
# File 'lib/cfndsl/jsonable.rb', line 205

def condition_refs
  @_condition_refs
end

#ref_childrenObject



209
210
211
# File 'lib/cfndsl/jsonable.rb', line 209

def ref_children
  [@argument].flatten
end

#to_json(*args) ⇒ Object



197
198
199
# File 'lib/cfndsl/jsonable.rb', line 197

def to_json(*args)
  as_json.to_json(*args)
end