You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Module: Aws::Resources::RequestParams::Param

Included in:
DataMember, Identifier, Literal
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/request_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#targetString (readonly)

Returns target.

Returns:

  • (String)

    target



65
66
67
# File 'aws-sdk-resources/lib/aws-sdk-resources/request_params.rb', line 65

def target
  @target
end

Instance Method Details

#apply(params, options = {}) ⇒ Object



67
68
69
70
71
72
73
74
# File 'aws-sdk-resources/lib/aws-sdk-resources/request_params.rb', line 67

def apply(params, options = {})
  if @final == -1
    build_context(params, options[:n]) << value(options)
  else
    build_context(params, options[:n])[@final] = value(options)
  end
  params
end

#initialize(options) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'aws-sdk-resources/lib/aws-sdk-resources/request_params.rb', line 49

def initialize(options)
  @target = options[:target].to_s
  @steps = []
  @target.scan(/\w+|\[\]|\[\*\]|\[[0-9]+\]/) do |step|
    case step
    when /\[\d+\]/ then @steps += [:array, step[1..-2].to_i]
    when /\[\*\]/ then @steps += [:array, :n]
    when '[]' then @steps += [:array, -1]
    else @steps += [:hash, step.to_sym]
    end
  end
  @steps.shift
  @final = @steps.pop
end