class HatenablogPublisher::Image
Attributes
filepath[R]
Public Class Methods
new(filepath)
click to toggle source
# File lib/hatenablog_publisher/image.rb, line 8 def initialize(filepath) @filepath = filepath end
Public Instance Methods
content()
click to toggle source
# File lib/hatenablog_publisher/image.rb, line 16 def content Base64.encode64(File.read(@filepath)) end
mime_type()
click to toggle source
# File lib/hatenablog_publisher/image.rb, line 12 def mime_type MIME::Types.type_for(@filepath).first end
title()
click to toggle source
# File lib/hatenablog_publisher/image.rb, line 20 def title File.basename(@filepath, '.*') end