Class: Aptly::Representation
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Aptly::Representation
- Defined in:
- lib/aptly/representation.rb
Overview
Base representation class to coerce transactional types into useful objects.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#connection ⇒ Connection
The connection used for instance operations.
Instance Method Summary collapse
-
#initialize(connection = nil, hash = {}) ⇒ Representation
constructor
Initialize a new representation.
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
#connection ⇒ Connection
Returns the connection used for instance operations.
24 25 26 |
# File 'lib/aptly/representation.rb', line 24 def connection @connection end |