class Ducksboard::Image

Public Class Methods

new(*args) click to toggle source
Calls superclass method
# File lib/ducksboard/image.rb, line 6
def initialize(*args)
  super
  @data[:value] ||={}
end

Public Instance Methods

caption() click to toggle source
# File lib/ducksboard/image.rb, line 25
def caption
  @data[:value][:caption]
end
caption=(text=nil) click to toggle source
# File lib/ducksboard/image.rb, line 29
def caption=(text=nil)
  @data[:value][:caption] = caption.to_s
end
source() click to toggle source
# File lib/ducksboard/image.rb, line 11
def source
  @data[:value][:source]
end
source=(image_location) click to toggle source
# File lib/ducksboard/image.rb, line 15
def source=(image_location)
  source_value = if image_location =~ /^http/
    image_location
  else
    'data:image/png;base64,' + 
      Base64.encode64(File.read(File.expand_path(image_location)))
  end
  @data[:value][:source] = source_value
end
timestamp() click to toggle source
# File lib/ducksboard/image.rb, line 33
def timestamp
  @data[:timestamp]
end
timestamp=(time) click to toggle source
# File lib/ducksboard/image.rb, line 37
def timestamp=(time)
  @data[:timestamp] = time
end