Class: Google::Compute::Data::UrlMapPathMatch

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

Overview

A class to manage data for path_matchers for url_map.

Direct Known Subclasses

UrlMapPathMatchApi, UrlMapPathMatchCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_serviceObject (readonly)

Returns the value of attribute default_service.



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

def default_service
  @default_service
end

#descriptionObject (readonly)

Returns the value of attribute description.



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

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#path_rulesObject (readonly)

Returns the value of attribute path_rules.



41
42
43
# File 'lib/google/compute/property/urlmap_path_matchers.rb', line 41

def path_rules
  @path_rules
end

Instance Method Details

#<=>(other) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/google/compute/property/urlmap_path_matchers.rb', line 72

def <=>(other)
  return false unless other.is_a? UrlMapPathMatch
  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



63
64
65
66
67
68
69
70
# File 'lib/google/compute/property/urlmap_path_matchers.rb', line 63

def ==(other)
  return false unless other.is_a? UrlMapPathMatch
  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



43
44
45
46
47
48
49
50
# File 'lib/google/compute/property/urlmap_path_matchers.rb', line 43

def to_json(_arg = nil)
  {
    'defaultService' => default_service,
    'description' => description,
    'name' => name,
    'pathRules' => path_rules
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/google/compute/property/urlmap_path_matchers.rb', line 52

def to_s
  {
    default_service: default_service,
    description: description,
    name: name,
    path_rules: ['[',
                 path_rules.map(&:to_json).join(', '),
                 ']'].join(' ')
  }.reject { |_k, v| v.nil? }.map { |k, v| "#{k}: #{v}" }.join(', ')
end