Module: Aws::Structure Private

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



67
68
69
# File 'lib/aws-sdk-core/structure.rb', line 67

def self.included(base_class)
  base_class.send(:undef_method, :each)
end

.new(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



56
57
58
59
60
61
62
63
64
# File 'lib/aws-sdk-core/structure.rb', line 56

def new(*args)
  if args.empty?
    Aws::EmptyStructure
  else
    struct = Struct.new(*args)
    struct.send(:include, Aws::Structure)
    struct
  end
end

Instance Method Details

#empty?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns ‘true` if all of the member values are `nil`.

Returns:

  • (Boolean)

    Returns ‘true` if all of the member values are `nil`.



18
19
20
# File 'lib/aws-sdk-core/structure.rb', line 18

def empty?
  values.compact == []
end

#initialize(values = {}) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
# File 'lib/aws-sdk-core/structure.rb', line 5

def initialize(values = {})
  values.each do |k, v|
    self[k] = v
  end
end

#key?(member_name) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns ‘true` if this structure has a value set for the given member.

Returns:

  • (Boolean)

    Returns ‘true` if this structure has a value set for the given member.



13
14
15
# File 'lib/aws-sdk-core/structure.rb', line 13

def key?(member_name)
  !self[member_name].nil?
end

#to_h(obj = self) ⇒ Hash Also known as: to_hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Deeply converts the Structure into a hash. Structure members that are ‘nil` are omitted from the resultant hash.

You can call #orig_to_h to get vanilla #to_h behavior as defined in stdlib Struct.

Returns:

  • (Hash)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/aws-sdk-core/structure.rb', line 29

def to_h(obj = self)
  case obj
  when Struct
    obj.members.each.with_object({}) do |member, hash|
      value = obj[member]
      hash[member] = to_hash(value) unless value.nil?
    end
  when Hash
    obj.each.with_object({}) do |(key, value), hash|
      hash[key] = to_hash(value)
    end
  when Array
    obj.collect { |value| to_hash(value) }
  else
    obj
  end
end

#to_s(obj = self) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Wraps the default #to_s logic with filtering of sensitive parameters.



49
50
51
# File 'lib/aws-sdk-core/structure.rb', line 49

def to_s(obj = self)
  Aws::Log::ParamFilter.new.filter(obj).to_s
end