Class: Aptly::Representation

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/aptly/representation.rb

Overview

Base representation class to coerce transactional types into useful objects.

Direct Known Subclasses

PublishedRepository, Repository, Snapshot

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection = nil, hash = {}) ⇒ Representation

Initialize a new representation



29
30
31
32
33
34
35
36
37
# File 'lib/aptly/representation.rb', line 29

def initialize(connection = nil, hash = {})
  # TODO: https://bugs.ruby-lang.org/issues/13358 prevents us from requiring
  #   a connection.
  # Mocha test mocking uses .allocate to mock quackability
  #   e.g. mock.responds_like_instance_of(Aptly::Repository)
  # So we need allocate to work, which it doesn't because of OpenStruct!
  @connection = connection
  super(hash)
end

Instance Attribute Details

#connectionConnection



24
25
26
# File 'lib/aptly/representation.rb', line 24

def connection
  @connection
end