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



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

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

Instance Method Details

#add_query(arg) ⇒ Object



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

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

#checkoutObject

Raises:



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

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

#commit(*args) ⇒ Object

Raises:



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

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

#mk_custom_optsObject



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

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



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

def pathname
  Pathname.new(path)
end

#pathname=(path) ⇒ Object



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

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

#saveObject

Raises:



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

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

#to_uriObject Also known as: to_url



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

def to_uri
  self
end

#to_yaml_stringObject



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

def to_yaml_string
  to_s
end