Class: Towsta::Kinds::ImageKind

Inherits:
MainKind
  • Object
show all
Defined in:
lib/towsta/kinds/image.rb

Instance Attribute Summary

Attributes inherited from MainKind

#content

Instance Method Summary collapse

Methods inherited from MainKind

#compare, #compare_parameterized, #get, #initialize, #kind

Constructor Details

This class inherits a constructor from Towsta::Kinds::MainKind

Instance Method Details

#exportObject



15
16
17
18
# File 'lib/towsta/kinds/image.rb', line 15

def export
  return '' if @content.nil?
  "(#{@content.to_s})"
end

#set(content) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/towsta/kinds/image.rb', line 6

def set content
  return @content = content if content.class == Bresson::ImageReference
  begin
    @content = Bresson::ImageReference.new JSON.parse(content[1..-2], :symbolize_names => true)
  rescue
    @content = nil
  end
end