Class: ConfigOMat::S3FallbackResponse

Inherits:
ConfigItem
  • Object
show all
Defined in:
lib/config_o_mat/shared/types.rb

Instance Attribute Summary collapse

Attributes inherited from ConfigItem

#errors

Instance Method Summary collapse

Methods inherited from ConfigItem

#==, #error, #errors?, #validate!

Constructor Details

#initialize(content:, content_type:, configuration_version:) ⇒ S3FallbackResponse

Returns a new instance of S3FallbackResponse.



462
463
464
465
466
# File 'lib/config_o_mat/shared/types.rb', line 462

def initialize(content:, content_type:, configuration_version:)
  @content = content
  @content_type = content_type
  @configuration_version = configuration_version
end

Instance Attribute Details

#configuration_versionObject (readonly)

Returns the value of attribute configuration_version.



460
461
462
# File 'lib/config_o_mat/shared/types.rb', line 460

def configuration_version
  @configuration_version
end

#contentObject (readonly)

Returns the value of attribute content.



460
461
462
# File 'lib/config_o_mat/shared/types.rb', line 460

def content
  @content
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



460
461
462
# File 'lib/config_o_mat/shared/types.rb', line 460

def content_type
  @content_type
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


478
479
480
481
482
483
484
485
486
# File 'lib/config_o_mat/shared/types.rb', line 478

def eql?(other)
  return false if !super(other)
  if other.content != content ||
     other.content_type != content_type ||
     other.configuration_version != configuration_version
    return false
  end
  true
end

#hashObject



474
475
476
# File 'lib/config_o_mat/shared/types.rb', line 474

def hash
  @content.hash ^ @content_type.hash ^ @configuration_version.hash
end

#validateObject



468
469
470
471
472
# File 'lib/config_o_mat/shared/types.rb', line 468

def validate
  error :content, PRESENCE_ERROR_MSG if @content.nil?
  error :content_type, PRESENCE_ERROR_MSG if @content_type.nil? || @content_type.empty?
  error :configuration_version, PRESENCE_ERROR_MSG if @configuration_version.nil? || @configuration_version.empty?
end