Exception: Structify::VersionRangeError

Inherits:
Error
  • Object
show all
Defined in:
lib/structify.rb

Overview

Error raised when trying to access a field outside its specified version range

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_name, record_version, valid_versions) ⇒ VersionRangeError

Returns a new instance of VersionRangeError.



88
89
90
91
92
93
94
95
96
97
# File 'lib/structify.rb', line 88

def initialize(field_name, record_version, valid_versions)
  @field_name = field_name
  @record_version = record_version
  @valid_versions = valid_versions
  
  message = "Field '#{field_name}' is not available in version #{record_version}. " \
            "This field is only available in versions: #{format_versions(valid_versions)}."
  
  super(message)
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name.



86
87
88
# File 'lib/structify.rb', line 86

def field_name
  @field_name
end

#record_versionObject (readonly)

Returns the value of attribute record_version.



86
87
88
# File 'lib/structify.rb', line 86

def record_version
  @record_version
end

#valid_versionsObject (readonly)

Returns the value of attribute valid_versions.



86
87
88
# File 'lib/structify.rb', line 86

def valid_versions
  @valid_versions
end