Class: EBPS::Text::Picture

Inherits:
String
  • Object
show all
Defined in:
lib/ebps/text/picture.rb

Constant Summary

Constants inherited from String

String::UMLAUT_SUB

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#sortable, #sortable!, #to_xs

Constructor Details

#initializePicture

Returns a new instance of Picture.



10
11
12
# File 'lib/ebps/text/picture.rb', line 10

def initialize
  super('')
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def height
  @height
end

#height_goalObject

Returns the value of attribute height_goal.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def height_goal
  @height_goal
end

#widthObject

Returns the value of attribute width.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def width
  @width
end

#width_goalObject

Returns the value of attribute width_goal.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def width_goal
  @width_goal
end

#xscaleObject

Returns the value of attribute xscale.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def xscale
  @xscale
end

#yscaleObject

Returns the value of attribute yscale.



9
10
11
# File 'lib/ebps/text/picture.rb', line 9

def yscale
  @yscale
end

Instance Method Details

#digestObject



13
14
15
# File 'lib/ebps/text/picture.rb', line 13

def digest
  @digest ||= Digest::MD5.hexdigest(self)
end

#empty?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
23
# File 'lib/ebps/text/picture.rb', line 16

def empty?
  super
rescue StandardError => err
  EBPS.logger.error("Text::Picture") { 
    sprintf "%s: %s", err.class, err.message
  }
  true
end

#filenameObject



24
25
26
# File 'lib/ebps/text/picture.rb', line 24

def filename
  @filename ||= "%s.%s" % [digest, EBPS.config.image_format]
end

#formatsObject



27
28
29
# File 'lib/ebps/text/picture.rb', line 27

def formats
  []
end

#imageObject



30
31
32
# File 'lib/ebps/text/picture.rb', line 30

def image
  Magick::Image.from_blob(self).first
end

#set_format(*ignore) ⇒ Object



33
34
35
# File 'lib/ebps/text/picture.rb', line 33

def set_format(*ignore)
  # ignore
end

#to_sObject

ignore



36
37
38
# File 'lib/ebps/text/picture.rb', line 36

def to_s
  image.inspect
end