Module: Awspec::BlackListForwardable

Included in:
ResourceReader, Type::Base
Defined in:
lib/awspec/resource_reader.rb

Defined Under Namespace

Classes: CalledMethodInBlackList

Instance Method Summary collapse

Instance Method Details

#method_missing_via_black_list(name, delegate_to: nil) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/awspec/resource_reader.rb', line 6

def method_missing_via_black_list(name, delegate_to: nil)
  raise ArgumentError, 'delegate_to: must be specified' unless delegate_to
  if match_black_list?(name) && !match_white_list?(name)
    raise CalledMethodInBlackList, "Method call #{name.inspect} is black-listed"
  end
  attr = delegate_to.send(name)
  if !attr.is_a?(Struct) && attr.class.name.match(/^Aws::/)
    ResourceReader.new(attr)
  else
    attr
  end
end