Class: Attachs::Types::Regular

Inherits:
Base
  • Object
show all
Defined in:
lib/attachs/types/regular.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Attachs::Types::Base

Instance Method Details

#basenameObject



7
8
9
# File 'lib/attachs/types/regular.rb', line 7

def basename
  @basename ||= File.basename(attachment.filename, ".#{extension}")
end

#extensionObject



11
12
13
# File 'lib/attachs/types/regular.rb', line 11

def extension
  @extension ||= File.extname(attachment.filename).from(1)
end

#image?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/attachs/types/regular.rb', line 15

def image?
  @image ||= attachment.content_type.start_with?('image')
end