class ActiveAws::CloudFormation::Template::DSLBlock

Returns a block that acts as a facade for the given target, allowing calls of the form

attribute 'value'

and transforms them into the equivalent

@target.attribute = 'value'

Attributes

target[R]

Public Class Methods

eval_using(target, block) click to toggle source
# File lib/active_aws/cloud_formation/template/dsl_block.rb, line 41
def eval_using(target, block)
  DSLBlock.new(target).instance_eval(&block)
end
new(target) click to toggle source
# File lib/active_aws/cloud_formation/template/dsl_block.rb, line 19
def initialize(target)
  @target = target
end

Public Instance Methods

method_missing(method_name, *args) click to toggle source
Calls superclass method
# File lib/active_aws/cloud_formation/template/dsl_block.rb, line 23
def method_missing(method_name, *args)
  if args.size == 0 && (target.is_a?(OpenStruct) || @target.respond_to?(method_name))
    return @target.send(method_name)
  elsif args.size == 1
    if @target.is_a?(Hash)
      return @target.store(method_name, args.first)
    else
      setter = "#{method_name}=".to_sym
      if @target.is_a?(OpenStruct) || @target.respond_to?(setter)
        return @target.send(setter, args.first)
      end
    end
  end
  # fall back to super
  super
end