Class: OCI::LogAnalytics::Models::CompareLineResult

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/log_analytics/models/compare_line_result.rb

Overview

The result of a comparison of two lines in the two content input strings.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CompareLineResult

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :left_content (String)

    The value to assign to the #left_content property

  • :right_content (String)

    The value to assign to the #right_content property

  • :diff_type (String)

    The value to assign to the #diff_type property

  • :left_indices (String)

    The value to assign to the #left_indices property

  • :right_indices (String)

    The value to assign to the #right_indices property



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 79

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.left_content = attributes[:'leftContent'] if attributes[:'leftContent']

  raise 'You cannot provide both :leftContent and :left_content' if attributes.key?(:'leftContent') && attributes.key?(:'left_content')

  self.left_content = attributes[:'left_content'] if attributes[:'left_content']

  self.right_content = attributes[:'rightContent'] if attributes[:'rightContent']

  raise 'You cannot provide both :rightContent and :right_content' if attributes.key?(:'rightContent') && attributes.key?(:'right_content')

  self.right_content = attributes[:'right_content'] if attributes[:'right_content']

  self.diff_type = attributes[:'diffType'] if attributes[:'diffType']

  raise 'You cannot provide both :diffType and :diff_type' if attributes.key?(:'diffType') && attributes.key?(:'diff_type')

  self.diff_type = attributes[:'diff_type'] if attributes[:'diff_type']

  self.left_indices = attributes[:'leftIndices'] if attributes[:'leftIndices']

  raise 'You cannot provide both :leftIndices and :left_indices' if attributes.key?(:'leftIndices') && attributes.key?(:'left_indices')

  self.left_indices = attributes[:'left_indices'] if attributes[:'left_indices']

  self.right_indices = attributes[:'rightIndices'] if attributes[:'rightIndices']

  raise 'You cannot provide both :rightIndices and :right_indices' if attributes.key?(:'rightIndices') && attributes.key?(:'right_indices')

  self.right_indices = attributes[:'right_indices'] if attributes[:'right_indices']
end

Instance Attribute Details

#diff_typeString

The result of the line comparison. An empty string means the lines being compared are the same. A pipe, |, means the lines are different, and a caret, > or <, means the line is only found either on the right or the left.

Returns:

  • (String)


28
29
30
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 28

def diff_type
  @diff_type
end

#left_contentString

A line from the content on the left. This may be empty if there is no matching line on the left for a line in the right content.

Returns:

  • (String)


15
16
17
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 15

def left_content
  @left_content
end

#left_indicesString

A comma delimited set of indices that identify which characters are different from those in the right string.

Returns:

  • (String)


34
35
36
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 34

def left_indices
  @left_indices
end

#right_contentString

A line from the content on the right. This may be empty if there is no matching line on the right for a line in the left content.

Returns:

  • (String)


21
22
23
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 21

def right_content
  @right_content
end

#right_indicesString

A comma delimited set of indices that identify which characters are different from those in the left string.

Returns:

  • (String)


40
41
42
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 40

def right_indices
  @right_indices
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 43

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'left_content': :'leftContent',
    'right_content': :'rightContent',
    'diff_type': :'diffType',
    'left_indices': :'leftIndices',
    'right_indices': :'rightIndices'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 56

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'left_content': :'String',
    'right_content': :'String',
    'diff_type': :'String',
    'left_indices': :'String',
    'right_indices': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



123
124
125
126
127
128
129
130
131
132
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 123

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    left_content == other.left_content &&
    right_content == other.right_content &&
    diff_type == other.diff_type &&
    left_indices == other.left_indices &&
    right_indices == other.right_indices
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 157

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


137
138
139
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 137

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



146
147
148
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 146

def hash
  [left_content, right_content, diff_type, left_indices, right_indices].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



190
191
192
193
194
195
196
197
198
199
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 190

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



184
185
186
# File 'lib/oci/log_analytics/models/compare_line_result.rb', line 184

def to_s
  to_hash.to_s
end