Class: RIO::CxURI

Inherits:
Object show all
Extended by:
Fwd
Defined in:
lib/rio/cxuri.rb

Instance Method Summary collapse

Methods included from Fwd

fwd, fwd_reader, fwd_readers, fwd_writer, fwd_writers

Constructor Details

#initialize(r) ⇒ CxURI

Returns a new instance of CxURI.



29
30
31
32
33
34
35
36
37
38
# File 'lib/rio/cxuri.rb', line 29

def initialize(r)
  case r
  when ::RIO::Rio
    u = r.uri
    @parts = ::Alt::URI::Gen::URIParts.parse(u.to_s)
    self.fragment = r.cx
  else
    @parts = ::Alt::URI::Gen::URIParts.parse(r.to_s)
  end
end

Instance Method Details

#fragmentObject



50
51
52
# File 'lib/rio/cxuri.rb', line 50

def fragment
  YAML.load(@parts.fragment) unless @parts.fragment.nil?
end

#fragment=(arg) ⇒ Object



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

def fragment=(arg)
  @parts.fragment = arg.nil? ? nil : YAML.dump(arg)
end

#to_rioObject



39
40
41
42
43
44
45
46
# File 'lib/rio/cxuri.rb', line 39

def to_rio
  nparts = @parts.clone
  cx = self.fragment
  nparts.fragment = nil
  nrio = Rio.rio(nparts.to_s)
  nrio.cx = cx
  nrio
end

#to_sObject



65
66
67
# File 'lib/rio/cxuri.rb', line 65

def to_s
  @parts.uri
end