Class: Terrafying::FnRef
Instance Method Summary collapse
-
#initialize(ref:, fn:, args: []) ⇒ FnRef
constructor
A new instance of FnRef.
- #realise ⇒ Object
Methods inherited from Ref
#<=>, #==, #[], #[]=, #downcase, #fn_call, #slice, #split, #strip, #to_s, #to_str
Constructor Details
#initialize(ref:, fn:, args: []) ⇒ FnRef
Returns a new instance of FnRef.
136 137 138 139 140 141 142 143 144 |
# File 'lib/terrafying/generator.rb', line 136 def initialize( ref:, fn:, args: [] ) @ref = ref @fn = fn @args = args end |
Instance Method Details
#realise ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/terrafying/generator.rb', line 146 def realise ref = @ref.realise args = @args.map do |arg| if arg == ARG_PLACEHOLDER ref elsif arg.is_a? String "\"#{arg}\"" else arg end end.join(', ') "#{@fn}(#{args})" end |