Sha256: 80fe1592696ddb5d2ebb9b2c5eeeec8525f413fbe3021834722b4974c2776882

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

require 'aws-sdk'
require 'awspec/resource_reader'
require 'awspec/helper/finder'

module Awspec::Type
  class Base
    include Awspec::Helper::Finder
    include Awspec::BlackListForwardable

    attr_reader :id, :resource_via_client

    def initialize(id = nil)
      @display_name = id
      super
      @id = nil
    end

    def to_s
      type = self.class.name.demodulize.underscore
      "#{type} '#{@display_name}'"
    end

    def inspect
      to_s
    end

    def exists?
      @id
    end

    def method_missing(name)
      describe = name.to_sym
      if @resource_via_client.members.include?(describe)
        @resource_via_client[describe]
      else
        super unless self.respond_to?(:hogehoge)
        method_missing_via_black_list(name, delegate_to: hogehoge)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
awspec-0.26.0 lib/awspec/type/base.rb