Sha256: 36a222d652abfcece9cc52a2282aa9728f7b16cbdec578fb72825c0d4c1d53ec

Contents?: true

Size: 294 Bytes

Versions: 4

Compression:

Stored size: 294 Bytes

Contents

# frozen_string_literal: true

module Hcloud
  class ImageResource < AbstractResource
    filter_attributes :type, :bound_to, :name

    bind_to Image

    def [](arg)
      case arg
      when Integer then find_by(id: arg)
      when String then find_by(name: arg)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hcloud-1.0.3 lib/hcloud/image_resource.rb
hcloud-1.0.2 lib/hcloud/image_resource.rb
hcloud-1.0.1 lib/hcloud/image_resource.rb
hcloud-1.0.0 lib/hcloud/image_resource.rb