Class: Google::Storage::Data::BucketVersioning

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

Overview

A class to manage data for Versioning for bucket.

Direct Known Subclasses

BucketVersioningApi, BucketVersioningCatalog

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enabledObject (readonly)

Returns the value of attribute enabled.



37
38
39
# File 'lib/google/storage/property/bucket_versioning.rb', line 37

def enabled
  @enabled
end

Instance Method Details

#<=>(other) ⇒ Object



60
61
62
63
64
65
66
67
68
# File 'lib/google/storage/property/bucket_versioning.rb', line 60

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



51
52
53
54
55
56
57
58
# File 'lib/google/storage/property/bucket_versioning.rb', line 51

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



39
40
41
42
43
# File 'lib/google/storage/property/bucket_versioning.rb', line 39

def to_json(_arg = nil)
  {
    'enabled' => enabled
  }.reject { |_k, v| v.nil? }.to_json
end

#to_sObject



45
46
47
48
49
# File 'lib/google/storage/property/bucket_versioning.rb', line 45

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