Class: Google::Compute::Data::UrlMapHostRules

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/google/compute/property/urlmap_host_rules.rb

Overview

A class to manage data for host_rules for url_map.

Direct Known Subclasses

UrlMapHostRulesApi, UrlMapHostRulesCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



38
39
40
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 38

def description
  @description
end

#hostsObject (readonly)

Returns the value of attribute hosts.



39
40
41
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 39

def hosts
  @hosts
end

#path_matcherObject (readonly)

Returns the value of attribute path_matcher.



40
41
42
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 40

def path_matcher
  @path_matcher
end

Instance Method Details

#<=>(other) ⇒ Object



67
68
69
70
71
72
73
74
75
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 67

def <=>(other)
  return false unless other.is_a? UrlMapHostRules
  compare_fields(other).each do |compare|
    next if compare[:self].nil? || compare[:other].nil?
    result = compare[:self] <=> compare[:other]
    return result unless result.zero?
  end
  0
end

#==(other) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 58

def ==(other)
  return false unless other.is_a? UrlMapHostRules
  compare_fields(other).each do |compare|
    next if compare[:self].nil? || compare[:other].nil?
    return false if compare[:self] != compare[:other]
  end
  true
end

#to_json(_arg = nil) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 42

def to_json(_arg = nil)
  {
    'description' => description,
    'hosts' => hosts,
    'pathMatcher' => path_matcher
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



50
51
52
53
54
55
56
# File 'lib/google/compute/property/urlmap_host_rules.rb', line 50

def to_s
  {
    description: description,
    hosts: hosts,
    path_matcher: path_matcher
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end