Class: LittleGhost::Content::Image

Inherits:
Data
  • Object
show all
Includes:
Module.new do # :nodoc: def to_h = Content.serialize(self) def to_json(*arguments) = JSON.generate(to_h, *arguments) end
Defined in:
lib/little_ghost/content.rb,
lib/little_ghost/content.rb

Overview

Contains binary image data, its MIME media type, and an optional display name. Content.serialize base64-encodes data in the serialized Hash.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, media_type:, name: nil) ⇒ Image

Returns a new instance of Image.



29
30
31
# File 'lib/little_ghost/content.rb', line 29

def initialize(data:, media_type:, name: nil)
  super
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



26
27
28
# File 'lib/little_ghost/content.rb', line 26

def data
  @data
end

#media_typeObject (readonly)

Returns the value of attribute media_type

Returns:

  • (Object)

    the current value of media_type



26
27
28
# File 'lib/little_ghost/content.rb', line 26

def media_type
  @media_type
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



26
27
28
# File 'lib/little_ghost/content.rb', line 26

def name
  @name
end