Class: Conreality::Binary

Inherits:
Object
  • Object
show all
Defined in:
lib/conreality/binary.rb

Overview

Represents a Conreality binary.

Constant Summary collapse

TABLE =

< Database::Row

:binary
KEY =
:id

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, id) ⇒ Binary

Returns a new instance of Binary.

Parameters:



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

#dataString (readonly)

The binary data.

Returns:

  • (String)


32
33
34
# File 'lib/conreality/binary.rb', line 32

def data
  @data
end

#idInteger (readonly)

The binary’s sequential identifier.

Returns:

  • (Integer)


14
15
16
# File 'lib/conreality/binary.rb', line 14

def id
  @id
end

#sha256String (readonly)

The binary’s unique identifier (SHA-256 fingerprint).

Returns:

  • (String)


20
21
22
# File 'lib/conreality/binary.rb', line 20

def sha256
  @sha256
end

#typeString

The binary’s MIME content type.

Returns:

  • (String)


26
27
28
# File 'lib/conreality/binary.rb', line 26

def type
  @type
end

Instance Method Details

#inspectString

Returns a developer-friendly representation of this binary.

Returns:

  • (String)


46
47
48
# File 'lib/conreality/binary.rb', line 46

def inspect
  sprintf("#<%s:%#0x(id: %s)>", self.class.name, self.__id__, @id)
end