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



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

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



23
24
25
# File 'lib/twingly/url/null_url.rb', line 23

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

#normalizedObject



15
16
17
# File 'lib/twingly/url/null_url.rb', line 15

def normalized
  self
end

#to_sObject



27
28
29
# File 'lib/twingly/url/null_url.rb', line 27

def to_s
  ""
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/twingly/url/null_url.rb', line 19

def valid?
  false
end