class Terrafying::Ref

Public Instance Methods

<=>(other) click to toggle source
# File lib/terrafying/generator.rb, line 51
def <=>(other)
  to_s <=> other.to_s
end
==(other) click to toggle source
# File lib/terrafying/generator.rb, line 55
def ==(other)
  to_s == other.to_s
end
[](key) click to toggle source
# File lib/terrafying/generator.rb, line 59
def [](key)
  if key.is_a? Numeric
    IndexRef.new(ref: self, idx: key)
  else
    AttributeRef.new(ref: self, key: key)
  end
end
[]=(_k, _v) click to toggle source
# File lib/terrafying/generator.rb, line 67
def []=(_k, _v)
  raise "You can't set a value this way"
end
downcase() click to toggle source
# File lib/terrafying/generator.rb, line 19
def downcase
  fn_call('lower')
end
fn_call(fn, *args) click to toggle source
# File lib/terrafying/generator.rb, line 14
def fn_call(fn, *args)
  args = [ARG_PLACEHOLDER] if args.empty?
  FnRef.new(fn: fn, args: args, ref: self)
end
realise() click to toggle source
# File lib/terrafying/generator.rb, line 39
def realise
  ''
end
slice(idx, length = 0) click to toggle source
# File lib/terrafying/generator.rb, line 31
def slice(idx, length = 0)
  if length != 0
    fn_call('slice', ARG_PLACEHOLDER, idx, idx + length)
  else
    fn_call('element', ARG_PLACEHOLDER, idx)
  end
end
split(separator) click to toggle source
# File lib/terrafying/generator.rb, line 27
def split(separator)
  fn_call('split', separator, ARG_PLACEHOLDER)
end
strip() click to toggle source
# File lib/terrafying/generator.rb, line 23
def strip
  fn_call('trimspace')
end
to_s() click to toggle source
# File lib/terrafying/generator.rb, line 43
def to_s
  "${#{realise}}"
end
to_str() click to toggle source
# File lib/terrafying/generator.rb, line 47
def to_str
  to_s
end