class Bizside::StringIO

Attributes

base_dir[RW]
content_type[RW]
file_size[RW]
fullpath[RW]
md5[RW]

Public Class Methods

new(string = '', mode = 'r+') click to toggle source
Calls superclass method
# File lib/bizside/string_io.rb, line 9
def initialize(string = '', mode = 'r+')
  super(string, mode)
  begin
    self.md5 = Digest::MD5.hexdigest(self.read)
  rescue
    #失敗しても何もしない。
  ensure
    self.rewind
  end
end

Public Instance Methods

original_dirname() click to toggle source
# File lib/bizside/string_io.rb, line 24
def original_dirname
  fullpath ? File.dirname(fullpath) : ''
end
original_filename() click to toggle source
# File lib/bizside/string_io.rb, line 20
def original_filename
  fullpath ? File.basename(fullpath) : ''
end
relative_dirname() click to toggle source
# File lib/bizside/string_io.rb, line 28
def relative_dirname
  if fullpath
    relpath = fullpath.sub(/^#{Regexp.quote(base_dir)}/,'').sub(/^\//,'')
    File.dirname(relpath) == '.' ? '' : File.dirname(relpath)
  else
    ''
  end
end