Class: Thingfish::Processor::Image::MagickOperations

Inherits:
Object
  • Object
show all
Defined in:
lib/thingfish/processor/image.rb

Overview

A struct that can represent the support in the installed ImageMagick for common operations. See Magick.formats for details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ext, support_string) ⇒ MagickOperations

Create a new MagickOperations for the given ext, reading the supported features of the format from support_string.



228
229
230
231
# File 'lib/thingfish/processor/image.rb', line 228

def initialize( ext, support_string )
	@ext = ext
	@blob, @read, @write, @multi = support_string.split('')
end

Instance Attribute Details

#blobObject (readonly)

Supported features



235
236
237
# File 'lib/thingfish/processor/image.rb', line 235

def blob
  @blob
end

#extObject (readonly)

Supported features



235
236
237
# File 'lib/thingfish/processor/image.rb', line 235

def ext
  @ext
end

#multiObject (readonly)

Supported features



235
236
237
# File 'lib/thingfish/processor/image.rb', line 235

def multi
  @multi
end

#readObject (readonly)

Supported features



235
236
237
# File 'lib/thingfish/processor/image.rb', line 235

def read
  @read
end

#writeObject (readonly)

Supported features



235
236
237
# File 'lib/thingfish/processor/image.rb', line 235

def write
  @write
end

Instance Method Details

#can_read?Boolean

Returns true if the operation string indicates that ImageMagick has native blob support for the associated type



258
259
260
# File 'lib/thingfish/processor/image.rb', line 258

def can_read?
	return (@read == 'r')
end

#can_write?Boolean

Returns true if the operation string indicates that ImageMagick has native blob support for the associated type



265
266
267
# File 'lib/thingfish/processor/image.rb', line 265

def can_write?
	return (@write == 'w')
end

#has_native_blob?Boolean

Returns true if the operation string indicates that ImageMagick has native blob support for the associated type



251
252
253
# File 'lib/thingfish/processor/image.rb', line 251

def has_native_blob?
	return (@blob == '*')
end

#supports_multi?Boolean

Returns true if the operation string indicates that ImageMagick has native blob support for the associated type



272
273
274
# File 'lib/thingfish/processor/image.rb', line 272

def supports_multi?
	return (@multi == '+')
end

#to_sObject

Return a human-readable description of the operations spec



239
240
241
242
243
244
245
246
# File 'lib/thingfish/processor/image.rb', line 239

def to_s
	return [
		self.has_native_blob?	? "Blob" : nil,
		self.can_read?			? "Readable" : nil,
		self.can_write?			? "Writable" : nil,
		self.supports_multi?	? "Multi" : nil,
	].compact.join(',')
end