Sha256: 54676fa88c9fec72cbc7acf91af01c65deec83cd3fab3601d4be70d618c21ee0

Contents?: true

Size: 734 Bytes

Versions: 3

Compression:

Stored size: 734 Bytes

Contents

module Bolt
  class Target
    attr_reader :host, :options

    def self.from_asserted_hash(hash)
      new(hash['host'], hash['options'])
    end

    def initialize(host, options = {})
      @host = host
      @options = options
    end

    def eql?(other)
      self.class.equal?(other.class) && @host == other.host && @options == other.options
    end
    alias == eql?

    def hash
      @host.hash ^ @options.hash
    end

    def to_s
      # Use Puppet::Pops::Types::StringConverter if it is available
      if Object.const_defined?(:Puppet) && Puppet.const_defined?(:Pops)
        Puppet::Pops::Types::StringConverter.singleton.convert(self)
      else
        "Target('#{@host}', #{@options})"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bolt-0.14.0 lib/bolt/target.rb
bolt-0.13.0 lib/bolt/target.rb
bolt-0.12.0 lib/bolt/target.rb