Sha256: f1c77419ec91dd9ab5242ff49396454a7b4189b305bb819ac95cdbf779a3948f

Contents?: true

Size: 569 Bytes

Versions: 4

Compression:

Stored size: 569 Bytes

Contents

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

module Awspec::Type
  class Base
    include Awspec::Helper::Finder
    attr_reader :id, :resource

    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 exists?
      @id
    end

    def method_missing(name)
      describe = name.to_sym
      if @resource.members.include?(describe)
        @resource[describe]
      else
        super
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
awspec-0.14.1 lib/awspec/type/base.rb
awspec-0.14.0 lib/awspec/type/base.rb
awspec-0.13.0 lib/awspec/type/base.rb
awspec-0.12.1 lib/awspec/type/base.rb