Class: Thingfish::Processor::Image::MagickOperations
- Inherits:
-
Object
- Object
- Thingfish::Processor::Image::MagickOperations
- 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
-
#blob ⇒ Object
readonly
Supported features.
-
#ext ⇒ Object
readonly
Supported features.
-
#multi ⇒ Object
readonly
Supported features.
-
#read ⇒ Object
readonly
Supported features.
-
#write ⇒ Object
readonly
Supported features.
Instance Method Summary collapse
-
#can_read? ⇒ Boolean
Returns
trueif the operation string indicates that ImageMagick has native blob support for the associated type. -
#can_write? ⇒ Boolean
Returns
trueif the operation string indicates that ImageMagick has native blob support for the associated type. -
#has_native_blob? ⇒ Boolean
Returns
trueif the operation string indicates that ImageMagick has native blob support for the associated type. -
#initialize(ext, support_string) ⇒ MagickOperations
constructor
Create a new MagickOperations for the given
ext, reading the supported features of the format fromsupport_string. -
#supports_multi? ⇒ Boolean
Returns
trueif the operation string indicates that ImageMagick has native blob support for the associated type. -
#to_s ⇒ Object
Return a human-readable description of the operations spec.
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.
213 214 215 216 |
# File 'lib/thingfish/processor/image.rb', line 213 def initialize( ext, support_string ) @ext = ext @blob, @read, @write, @multi = support_string.split('') end |
Instance Attribute Details
#blob ⇒ Object (readonly)
Supported features
220 221 222 |
# File 'lib/thingfish/processor/image.rb', line 220 def blob @blob end |
#ext ⇒ Object (readonly)
Supported features
220 221 222 |
# File 'lib/thingfish/processor/image.rb', line 220 def ext @ext end |
#multi ⇒ Object (readonly)
Supported features
220 221 222 |
# File 'lib/thingfish/processor/image.rb', line 220 def multi @multi end |
#read ⇒ Object (readonly)
Supported features
220 221 222 |
# File 'lib/thingfish/processor/image.rb', line 220 def read @read end |
#write ⇒ Object (readonly)
Supported features
220 221 222 |
# File 'lib/thingfish/processor/image.rb', line 220 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
243 244 245 |
# File 'lib/thingfish/processor/image.rb', line 243 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
250 251 252 |
# File 'lib/thingfish/processor/image.rb', line 250 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
236 237 238 |
# File 'lib/thingfish/processor/image.rb', line 236 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
257 258 259 |
# File 'lib/thingfish/processor/image.rb', line 257 def supports_multi? return (@multi == '+') end |
#to_s ⇒ Object
Return a human-readable description of the operations spec
224 225 226 227 228 229 230 231 |
# File 'lib/thingfish/processor/image.rb', line 224 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 |