Module: Seamus

Defined in:
lib/seamus.rb,
lib/seamus/builder.rb,
lib/seamus/file/text.rb,
lib/seamus/file/audio.rb,
lib/seamus/file/image.rb,
lib/seamus/file/video.rb,
lib/seamus/file/application.rb,
lib/seamus/standard_additions.rb,
lib/seamus/inspector/text_inspector.rb,
lib/seamus/processor/text_processor.rb,
lib/seamus/inspector/audio_inspector.rb,
lib/seamus/inspector/image_inspector.rb,
lib/seamus/inspector/video_inspector.rb,
lib/seamus/processor/audio_processor.rb,
lib/seamus/processor/image_processor.rb,
lib/seamus/processor/video_processor.rb,
lib/seamus/inspector/application_inspector.rb,
lib/seamus/processor/application_processor.rb

Overview

Seamus - The File Inspector

Seamus inspects your file and discovers useful attributes. It is at its best with rich digital media - video, audio and image files - but is suitable for use with any file type. Just provide a path to Seamus::Builder.new for an enhanced File object that knows about your file.

movie = Seamus::Builder.new("/path/to/my/movie.mov")

movie.width
# => 720

movie.video_codec
# => 'h264'

Or if you prefer, include Seamus in a class and use the has_file :file_attribute class method for attachments.

class Upload
  include Seamus
  has_file :file
end

u = Upload.new
u.file = "/path/to/image.jpg"
u.file.width
# => 3284

Seamus supports thumbnail creation for visual media types. The #thumbnail method returns an IO instance.

u.file.thumbnail
# => #<IO:0x357898>

Defined Under Namespace

Modules: ApplicationInspector, ApplicationProcessor, AudioInspector, AudioProcessor, Builder, ClassMethods, File, ImageInspector, ImageProcessor, InstanceMethods, StandardAdditions, TextInspector, TextProcessor, VideoInspector, VideoProcessor

Class Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



89
90
91
92
# File 'lib/seamus.rb', line 89

def self.included(receiver)
  receiver.extend         ClassMethods
  receiver.send :include, InstanceMethods
end