Class: RIO::StrIO::RL

Inherits:
RL::IOIBase
  • Object
show all
Defined in:
lib/rio/scheme/strio.rb

Constant Summary collapse

RIOSCHEME =
'strio'
RIOPATH =
RIO::RL::CHMAP.invert[RIOSCHEME].to_s.freeze
SPLIT_RE =

must be able to process both parse(‘rio:strio’,string) parse(‘rio:strio:0xHEXIOS’)

%r|0x([0-9a-fA-F]+)$|

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str = "") ⇒ RL

Returns a new instance of RL.



50
51
52
53
# File 'lib/rio/scheme/strio.rb', line 50

def initialize(str="")
  @str = str
  super
end

Instance Attribute Details

#strObject

Returns the value of attribute str.



49
50
51
# File 'lib/rio/scheme/strio.rb', line 49

def str
  @str
end

Class Method Details

.splitrl(s) ⇒ Object



61
62
63
64
65
66
67
68
# File 'lib/rio/scheme/strio.rb', line 61

def self.splitrl(s)
  sub,opq,whole = split_riorl(s)
  if bm = SPLIT_RE.match(opq)
    oid = bm[1].hex
    str = ObjectSpace._id2ref(oid)
    [str]
  end
end

Instance Method Details

#opaqueObject



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

def opaque() sprintf('0x%08x',@str.object_id) end

#open(m, *args) ⇒ Object



70
71
72
# File 'lib/rio/scheme/strio.rb', line 70

def open(m,*args)
  super(::StringIO.new(@str,m.to_s,*args))
end