Class: Conreality::Binary
- Inherits:
-
Object
- Object
- Conreality::Binary
- Defined in:
- lib/conreality/binary.rb
Overview
Represents a Conreality binary.
Constant Summary collapse
- TABLE =
< Database::Row
:binary
- KEY =
:id
Instance Attribute Summary collapse
-
#data ⇒ String
readonly
The binary data.
-
#id ⇒ Integer
readonly
The binary’s sequential identifier.
-
#sha256 ⇒ String
readonly
The binary’s unique identifier (SHA-256 fingerprint).
-
#type ⇒ String
The binary’s MIME content type.
Instance Method Summary collapse
-
#initialize(session, id) ⇒ Binary
constructor
A new instance of Binary.
-
#inspect ⇒ String
Returns a developer-friendly representation of this binary.
Constructor Details
#initialize(session, id) ⇒ Binary
Returns a new instance of Binary.
37 38 39 40 |
# File 'lib/conreality/binary.rb', line 37 def initialize(session, id) super(session) @id = id.to_i end |
Instance Attribute Details
#data ⇒ String (readonly)
The binary data.
32 33 34 |
# File 'lib/conreality/binary.rb', line 32 def data @data end |
#id ⇒ Integer (readonly)
The binary’s sequential identifier.
14 15 16 |
# File 'lib/conreality/binary.rb', line 14 def id @id end |
#sha256 ⇒ String (readonly)
The binary’s unique identifier (SHA-256 fingerprint).
20 21 22 |
# File 'lib/conreality/binary.rb', line 20 def sha256 @sha256 end |
#type ⇒ String
The binary’s MIME content type.
26 27 28 |
# File 'lib/conreality/binary.rb', line 26 def type @type end |
Instance Method Details
#inspect ⇒ String
Returns a developer-friendly representation of this binary.
46 47 48 |
# File 'lib/conreality/binary.rb', line 46 def inspect sprintf("#<%s:%#0x(id: %s)>", self.class.name, self.__id__, @id) end |