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.
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
#blob ⇒ Object (readonly)
Supported features
235 236 237 |
# File 'lib/thingfish/processor/image.rb', line 235 def blob @blob end |
#ext ⇒ Object (readonly)
Supported features
235 236 237 |
# File 'lib/thingfish/processor/image.rb', line 235 def ext @ext end |
#multi ⇒ Object (readonly)
Supported features
235 236 237 |
# File 'lib/thingfish/processor/image.rb', line 235 def multi @multi end |
#read ⇒ Object (readonly)
Supported features
235 236 237 |
# File 'lib/thingfish/processor/image.rb', line 235 def read @read end |
#write ⇒ Object (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_s ⇒ Object
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 |