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.



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

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

Instance Method Details

#all_refsObject



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

def all_refs
  @_refs
end

#as_json(_options = {}) ⇒ Object



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

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

#condition_refsObject



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

def condition_refs
  @_condition_refs
end

#ref_childrenObject



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

def ref_children
  [@argument].flatten
end

#to_json(*args) ⇒ Object



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

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