Class: RIO::Temp::RL

Inherits:
RL::Base
  • Object
show all
Defined in:
lib/rio/scheme/temp.rb

Constant Summary collapse

RIOSCHEME =
'temp'
RIOPATH =
RIO::RL::CHMAP.invert[RIOSCHEME].to_s.freeze
DFLT_PREFIX =
'rio'
DFLT_TMPDIR =
::Dir::tmpdir
SPLIT_RE =
%r|(?:(.*)/)?([^/]*)$|.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_prefix = DFLT_PREFIX, temp_dir = DFLT_TMPDIR) ⇒ RL

Returns a new instance of RL.



48
49
50
51
52
53
# File 'lib/rio/scheme/temp.rb', line 48

def initialize(file_prefix=DFLT_PREFIX,temp_dir=DFLT_TMPDIR)
  #puts "initialize(#{file_prefix.inspect},#{temp_dir.inspect})"
  @prefix = file_prefix || DFLT_PREFIX
  @tmpdir = temp_dir || DFLT_TMPDIR
  super
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



47
48
49
# File 'lib/rio/scheme/temp.rb', line 47

def prefix
  @prefix
end

#tmpdirObject (readonly)

Returns the value of attribute tmpdir.



47
48
49
# File 'lib/rio/scheme/temp.rb', line 47

def tmpdir
  @tmpdir
end

Class Method Details

.splitrl(s) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/rio/scheme/temp.rb', line 63

def self.splitrl(s)
  sub,opq,whole = split_riorl(s)
  if opq.nil? or opq.empty?
    []
  elsif bm = SPLIT_RE.match(opq)
    tdir = bm[1] unless bm[1].nil? or bm[1].empty?
    tpfx = bm[2] unless bm[2].nil? or bm[2].empty?
    [tpfx,tdir]
  else
    []
  end
end

Instance Method Details

#opaqueObject



56
57
58
59
60
# File 'lib/rio/scheme/temp.rb', line 56

def opaque()
  td = self.escape(@tmpdir.to_s)
  td += '/' unless td.nil? or td.empty? or (td != '/' and td[-1] == ?/)
  td + self.escape(@prefix)
end

#schemeObject

def path() nil end



55
# File 'lib/rio/scheme/temp.rb', line 55

def scheme() self.class.const_get(:RIOSCHEME) end