class OCI::LogAnalytics::Models::RegexMatchResult
Attributes
The matched log entry end index. @return [Integer]
The regular expression score. @return [Integer]
The regular expression steps information. @return [Array<OCI::LogAnalytics::Models::StepInfo>]
The regular expression step count. @return [Integer]
The regular expression match information. @return [Hash<String, OCI::LogAnalytics::Models::MatchInfo>]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/oci/log_analytics/models/regex_match_result.rb, line 31 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'matched_log_entry_end_index': :'matchedLogEntryEndIndex', 'regex_score': :'regexScore', 'regex_steps_info': :'regexStepsInfo', 'step_count': :'stepCount', 'sub_regexes_match_info': :'subRegexesMatchInfo' # rubocop:enable Style/SymbolLiteral } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [Integer] :matched_log_entry_end_index The value to assign to the {#matched_log_entry_end_index} property @option attributes [Integer] :regex_score The value to assign to the {#regex_score} property @option attributes [Array<OCI::LogAnalytics::Models::StepInfo>] :regex_steps_info The value to assign to the {#regex_steps_info} property @option attributes [Integer] :step_count The value to assign to the {#step_count} property @option attributes [Hash<String, OCI::LogAnalytics::Models::MatchInfo>] :sub_regexes_match_info The value to assign to the {#sub_regexes_match_info} property
# File lib/oci/log_analytics/models/regex_match_result.rb, line 67 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.matched_log_entry_end_index = attributes[:'matchedLogEntryEndIndex'] if attributes[:'matchedLogEntryEndIndex'] raise 'You cannot provide both :matchedLogEntryEndIndex and :matched_log_entry_end_index' if attributes.key?(:'matchedLogEntryEndIndex') && attributes.key?(:'matched_log_entry_end_index') self.matched_log_entry_end_index = attributes[:'matched_log_entry_end_index'] if attributes[:'matched_log_entry_end_index'] self.regex_score = attributes[:'regexScore'] if attributes[:'regexScore'] raise 'You cannot provide both :regexScore and :regex_score' if attributes.key?(:'regexScore') && attributes.key?(:'regex_score') self.regex_score = attributes[:'regex_score'] if attributes[:'regex_score'] self.regex_steps_info = attributes[:'regexStepsInfo'] if attributes[:'regexStepsInfo'] raise 'You cannot provide both :regexStepsInfo and :regex_steps_info' if attributes.key?(:'regexStepsInfo') && attributes.key?(:'regex_steps_info') self.regex_steps_info = attributes[:'regex_steps_info'] if attributes[:'regex_steps_info'] self.step_count = attributes[:'stepCount'] if attributes[:'stepCount'] raise 'You cannot provide both :stepCount and :step_count' if attributes.key?(:'stepCount') && attributes.key?(:'step_count') self.step_count = attributes[:'step_count'] if attributes[:'step_count'] self.sub_regexes_match_info = attributes[:'subRegexesMatchInfo'] if attributes[:'subRegexesMatchInfo'] raise 'You cannot provide both :subRegexesMatchInfo and :sub_regexes_match_info' if attributes.key?(:'subRegexesMatchInfo') && attributes.key?(:'sub_regexes_match_info') self.sub_regexes_match_info = attributes[:'sub_regexes_match_info'] if attributes[:'sub_regexes_match_info'] end
Attribute type mapping.
# File lib/oci/log_analytics/models/regex_match_result.rb, line 44 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'matched_log_entry_end_index': :'Integer', 'regex_score': :'Integer', 'regex_steps_info': :'Array<OCI::LogAnalytics::Models::StepInfo>', 'step_count': :'Integer', 'sub_regexes_match_info': :'Hash<String, OCI::LogAnalytics::Models::MatchInfo>' # rubocop:enable Style/SymbolLiteral } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] other the other object to be compared
# File lib/oci/log_analytics/models/regex_match_result.rb, line 111 def ==(other) return true if equal?(other) self.class == other.class && matched_log_entry_end_index == other.matched_log_entry_end_index && regex_score == other.regex_score && regex_steps_info == other.regex_steps_info && step_count == other.step_count && sub_regexes_match_info == other.sub_regexes_match_info end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/oci/log_analytics/models/regex_match_result.rb, line 145 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
@see the `==` method @param [Object] other the other object to be compared
# File lib/oci/log_analytics/models/regex_match_result.rb, line 125 def eql?(other) self == other end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/oci/log_analytics/models/regex_match_result.rb, line 134 def hash [matched_log_entry_end_index, regex_score, regex_steps_info, step_count, sub_regexes_match_info].hash end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/oci/log_analytics/models/regex_match_result.rb, line 178 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/oci/log_analytics/models/regex_match_result.rb, line 172 def to_s to_hash.to_s end
Private Instance Methods
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/oci/log_analytics/models/regex_match_result.rb, line 195 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end