Class: Conreality::Binary

Inherits:
Database::Row show all
Defined in:
lib/conreality/binary.rb

Overview

Represents a Conreality binary.

Constant Summary collapse

TABLE =
:binary
KEY =
:id

Constants inherited from Database::Row

Database::Row::SCHEMA

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Database::Row

attr_accessor, attr_reader, attr_wrapper, attr_writer, #get, #key, key_attr, #set!, table_name

Constructor Details

#initialize(client, id) ⇒ Binary


35
36
37
38
# File 'lib/conreality/binary.rb', line 35

def initialize(client, id)
  super(client)
  @id = id.to_i
end

Instance Attribute Details

#dataString (readonly)

The binary data.


30
31
32
# File 'lib/conreality/binary.rb', line 30

def data
  @data
end

#idInteger (readonly)

The binary's sequential identifier.


12
13
14
# File 'lib/conreality/binary.rb', line 12

def id
  @id
end

#sha256String (readonly)

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


18
19
20
# File 'lib/conreality/binary.rb', line 18

def sha256
  @sha256
end

#typeString

The binary's MIME content type.


24
25
26
# File 'lib/conreality/binary.rb', line 24

def type
  @type
end

Instance Method Details

#inspectString

Returns a developer-friendly representation of this binary.


44
45
46
# File 'lib/conreality/binary.rb', line 44

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