Sha256: e149d6c5af115f49022de9c91b535323617dbccbb5c75b6611d00139b5695f25

Contents?: true

Size: 552 Bytes

Versions: 2

Compression:

Stored size: 552 Bytes

Contents

# Blob methods for accessing a blob via a dir name and base name.
# Exclusively for the Blob class.

class Blob
  
  #attr_accessor :dir   # Dir name of this blob, e.g. "/my/photos"
  #attr_accessor :base  # Base name of this blob, e.g. "photo.jpg"

  def dir; @dir;  end
  def dir=(x); @dir=x; end

  def base; @base;  end
  def base=(x); @base=x; end

  def initialize(options = {})
    @dir ||= options[:dir]
    @base ||= options[:base]
  end

  def name
    @name ||= "#{dir}/#{base}"
  end

  def ext
    base =~ /\.(\w+)$/ ? $1 : nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sixarm_ruby_blob-1.0.3 lib/sixarm_ruby_blob/dir.rb
sixarm_ruby_blob-1.0.1 lib/sixarm_ruby_blob/dir.rb