Sha256: 7611a98ce3e013a9ffd374b1d2f87923ac4f120e698fa79e956293f703dbdff7

Contents?: true

Size: 331 Bytes

Versions: 7

Compression:

Stored size: 331 Bytes

Contents

# frozen_string_literal: true

module Hcloud
  class DatacenterResource < AbstractResource
    filter_attributes :name

    bind_to Datacenter

    def recommended
      all.first
    end

    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

7 entries across 7 versions & 1 rubygems

Version Path
hcloud-1.3.0 lib/hcloud/datacenter_resource.rb
hcloud-1.2.0 lib/hcloud/datacenter_resource.rb
hcloud-1.1.0 lib/hcloud/datacenter_resource.rb
hcloud-1.0.3 lib/hcloud/datacenter_resource.rb
hcloud-1.0.2 lib/hcloud/datacenter_resource.rb
hcloud-1.0.1 lib/hcloud/datacenter_resource.rb
hcloud-1.0.0 lib/hcloud/datacenter_resource.rb