Class: BetterUri::URI

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/better_uri/uri.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ URI

Returns a new instance of URI.



11
12
13
# File 'lib/better_uri/uri.rb', line 11

def initialize(string)
  @uri = super(URI_CORE.parse(string.to_s))
end

Instance Attribute Details

#uriObject (readonly)

Returns the value of attribute uri.



9
10
11
# File 'lib/better_uri/uri.rb', line 9

def uri
  @uri
end

Instance Method Details

#dupObject



19
20
21
# File 'lib/better_uri/uri.rb', line 19

def dup
  self.class.new(@uri.to_s)
end

#empty?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/better_uri/uri.rb', line 15

def empty?
  @uri.to_s.empty?
end

#queryObject Also known as: params



32
33
34
# File 'lib/better_uri/uri.rb', line 32

def query
  BetterUri::Query.new(self)
end

#query_stringObject



23
24
25
# File 'lib/better_uri/uri.rb', line 23

def query_string
  @uri.query
end

#query_string=(val) ⇒ Object Also known as: query=



27
28
29
# File 'lib/better_uri/uri.rb', line 27

def query_string=(val)
  @uri.query = val
end