Class: Twingly::URL::NullURL

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/twingly/url/null_url.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



6
7
8
9
10
11
# File 'lib/twingly/url/null_url.rb', line 6

def method_missing(name, *)
  error = NoMethodError.new("undefined method `#{name}'")
  raise error unless Twingly::URL.instance_methods.include?(name)

  ""
end

Instance Method Details

#<=>(other) ⇒ Object



21
22
23
# File 'lib/twingly/url/null_url.rb', line 21

def <=>(other)
  self.to_s <=> other.to_s
end

#normalizedObject



13
14
15
# File 'lib/twingly/url/null_url.rb', line 13

def normalized
  self
end

#to_sObject



25
26
27
# File 'lib/twingly/url/null_url.rb', line 25

def to_s
  ""
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/twingly/url/null_url.rb', line 17

def valid?
  false
end