Class: URI::Generic

Inherits:
Object show all
Defined in:
lib/uri/generic_ex.rb

Direct Known Subclasses

GenericEx

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.yaml_load(val) ⇒ Object



94
95
96
# File 'lib/uri/generic_ex.rb', line 94

def self.yaml_load ( val )
  URI.parse(val)
end

Instance Method Details

#add_query(arg) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/uri/generic_ex.rb', line 69

def add_query ( arg )
  if query.nil?
    self.query = arg
  else
    self.query += ',' + arg
  end
end

#checkoutObject

Raises:



57
58
59
# File 'lib/uri/generic_ex.rb', line 57

def checkout
  raise CheckoutError, "Can't checkout a #{self.class}"
end

#commit(*args) ⇒ Object

Raises:



61
62
63
# File 'lib/uri/generic_ex.rb', line 61

def commit ( *args )
  raise CommitError, "Can't commit a #{self.class}"
end

#mk_custom_optsObject



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/uri/generic_ex.rb', line 78

def mk_custom_opts
  opts = []
  return opts if @query.nil?
  @query.split(/,/).map do |x|
    k, v = x.split(/=/)
    k = URI.decode(k)
    if k.size == 1
      opts << "-#{k}"
    else
      opts << "--#{k}"
    end
    opts << URI.decode(v) unless v.nil?
  end
  opts
end

#pathnameObject



40
41
42
# File 'lib/uri/generic_ex.rb', line 40

def pathname
  Pathname.new(path)
end

#pathname=(path) ⇒ Object



44
45
46
# File 'lib/uri/generic_ex.rb', line 44

def pathname= ( path )
  self.path = path.to_s
end

#saveObject

Raises:



65
66
67
# File 'lib/uri/generic_ex.rb', line 65

def save
  raise SaveError, "Can't save a #{self.class}"
end

#to_uriObject Also known as: to_url



52
53
54
# File 'lib/uri/generic_ex.rb', line 52

def to_uri
  self
end

#to_yaml_stringObject



48
49
50
# File 'lib/uri/generic_ex.rb', line 48

def to_yaml_string
  to_s
end