Class: AIX::Errlog::Match
- Inherits:
-
Object
- Object
- AIX::Errlog::Match
- Defined in:
- lib/aix/errlog/match.rb
Overview
Match convenience function. Gets a Leaf match for comparing against class.
Instance Attribute Summary collapse
-
#left ⇒ Object
Returns the value of attribute left.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#right ⇒ Object
Returns the value of attribute right.
Class Method Summary collapse
- .class ⇒ Object
-
.connwhere ⇒ Object
Match convenience function.
- .crcid ⇒ Object
-
.detail_data ⇒ Object
Match convenience function.
-
.errdiag ⇒ Object
Match convenience function.
-
.flag_err64 ⇒ Object
Match convenience function.
-
.flag_errdup ⇒ Object
Match convenience function.
-
.in ⇒ Object
Match convenience function.
- .label ⇒ Object
- .machineid ⇒ Object
- .nodeid ⇒ Object
-
.rclass ⇒ Object
Match convenience function.
-
.resource ⇒ Object
Match convenience function.
-
.rtype ⇒ Object
Match convenience function.
- .sequence ⇒ Object
-
.symptom_data ⇒ Object
Match convenience function.
- .timestamp ⇒ Object
-
.type ⇒ Object
Match convenience function.
-
.vpd_ibm ⇒ Object
Match convenience function.
-
.vpd_user ⇒ Object
Match convenience function.
-
.wparid ⇒ Object
Match convenience function.
Instance Method Summary collapse
- #! ⇒ Object
- #!=(other) ⇒ Object
- #&(other) ⇒ Object
- #<(other) ⇒ Object
- #<=(other) ⇒ Object
- #==(other) ⇒ Object
- #>(other) ⇒ Object
- #>=(other) ⇒ Object
- #^(other) ⇒ Object
- #include?(other) ⇒ Boolean
-
#initialize(left:, operator: nil, right: nil) ⇒ Match
constructor
A new instance of Match.
- #to_struct ⇒ Object
- #|(other) ⇒ Object
Constructor Details
#initialize(left:, operator: nil, right: nil) ⇒ Match
Returns a new instance of Match.
42 43 44 45 46 |
# File 'lib/aix/errlog/match.rb', line 42 def initialize(left:, operator: nil, right: nil) @left = left @operator = operator @right = right end |
Instance Attribute Details
#left ⇒ Object
Returns the value of attribute left.
40 41 42 |
# File 'lib/aix/errlog/match.rb', line 40 def left @left end |
#operator ⇒ Object
Returns the value of attribute operator.
40 41 42 |
# File 'lib/aix/errlog/match.rb', line 40 def operator @operator end |
#right ⇒ Object
Returns the value of attribute right.
40 41 42 |
# File 'lib/aix/errlog/match.rb', line 40 def right @right end |
Class Method Details
.class ⇒ Object
193 194 195 |
# File 'lib/aix/errlog/match.rb', line 193 def self.class new(left: :class) end |
.connwhere ⇒ Object
Match convenience function. Gets a Leaf match for comparing against connwhere.
240 241 242 |
# File 'lib/aix/errlog/match.rb', line 240 def self.connwhere new(left: :connwhere) end |
.crcid ⇒ Object
175 176 177 |
# File 'lib/aix/errlog/match.rb', line 175 def self.crcid new(left: :crcid) end |
.detail_data ⇒ Object
Match convenience function. Gets a Leaf match for comparing against detail_data.
258 259 260 |
# File 'lib/aix/errlog/match.rb', line 258 def self.detail_data new(left: :detail_data) end |
.errdiag ⇒ Object
Match convenience function. Gets a Leaf match for comparing against errdiag.
270 271 272 |
# File 'lib/aix/errlog/match.rb', line 270 def self.errdiag new(left: :errdiag) end |
.flag_err64 ⇒ Object
Match convenience function. Gets a Leaf match for comparing against flag_err64.
246 247 248 |
# File 'lib/aix/errlog/match.rb', line 246 def self.flag_err64 new(left: :flag_err64) end |
.flag_errdup ⇒ Object
Match convenience function. Gets a Leaf match for comparing against flag_errdup.
252 253 254 |
# File 'lib/aix/errlog/match.rb', line 252 def self.flag_errdup new(left: :flag_errdup) end |
.in ⇒ Object
Match convenience function. Gets a Leaf match for comparing against in.
234 235 236 |
# File 'lib/aix/errlog/match.rb', line 234 def self.in new(left: :in) end |
.label ⇒ Object
163 164 165 |
# File 'lib/aix/errlog/match.rb', line 163 def self.label new(left: :label) end |
.machineid ⇒ Object
181 182 183 |
# File 'lib/aix/errlog/match.rb', line 181 def self.machineid new(left: :machineid) end |
.nodeid ⇒ Object
187 188 189 |
# File 'lib/aix/errlog/match.rb', line 187 def self.nodeid new(left: :nodeid) end |
.rclass ⇒ Object
Match convenience function. Gets a Leaf match for comparing against rclass.
211 212 213 |
# File 'lib/aix/errlog/match.rb', line 211 def self.rclass new(left: :rclass) end |
.resource ⇒ Object
Match convenience function. Gets a Leaf match for comparing against resource.
205 206 207 |
# File 'lib/aix/errlog/match.rb', line 205 def self.resource new(left: :resource) end |
.rtype ⇒ Object
Match convenience function. Gets a Leaf match for comparing against rtype.
217 218 219 |
# File 'lib/aix/errlog/match.rb', line 217 def self.rtype new(left: :rtype) end |
.sequence ⇒ Object
157 158 159 |
# File 'lib/aix/errlog/match.rb', line 157 def self.sequence new(left: :sequence) end |
.symptom_data ⇒ Object
Match convenience function. Gets a Leaf match for comparing against symptom_data.
264 265 266 |
# File 'lib/aix/errlog/match.rb', line 264 def self.symptom_data new(left: :symptom_data) end |
.timestamp ⇒ Object
169 170 171 |
# File 'lib/aix/errlog/match.rb', line 169 def self. new(left: :timestamp) end |
.type ⇒ Object
Match convenience function. Gets a Leaf match for comparing against type.
199 200 201 |
# File 'lib/aix/errlog/match.rb', line 199 def self.type new(left: :type) end |
.vpd_ibm ⇒ Object
Match convenience function. Gets a Leaf match for comparing against vpd_ibm.
223 224 225 |
# File 'lib/aix/errlog/match.rb', line 223 def self.vpd_ibm new(left: :vpd_ibm) end |
.vpd_user ⇒ Object
Match convenience function. Gets a Leaf match for comparing against vpd_user.
229 230 231 |
# File 'lib/aix/errlog/match.rb', line 229 def self.vpd_user new(left: :vpd_user) end |
.wparid ⇒ Object
Match convenience function. Gets a Leaf match for comparing against wparid.
276 277 278 |
# File 'lib/aix/errlog/match.rb', line 276 def self.wparid new(left: :wparid) end |
Instance Method Details
#! ⇒ Object
147 148 149 150 151 152 |
# File 'lib/aix/errlog/match.rb', line 147 def ! Match.new( left: self, operator: :not, ) end |
#!=(other) ⇒ Object
96 97 98 99 100 |
# File 'lib/aix/errlog/match.rb', line 96 def !=(other) @operator = :ne @right = other self end |
#&(other) ⇒ Object
126 127 128 129 130 131 132 |
# File 'lib/aix/errlog/match.rb', line 126 def &(other) Match.new( left: self, operator: :and, right: other, ) end |
#<(other) ⇒ Object
106 107 108 109 110 |
# File 'lib/aix/errlog/match.rb', line 106 def <(other) @operator = :lt @right = other self end |
#<=(other) ⇒ Object
111 112 113 114 115 |
# File 'lib/aix/errlog/match.rb', line 111 def <=(other) @operator = :le @right = other self end |
#==(other) ⇒ Object
91 92 93 94 95 |
# File 'lib/aix/errlog/match.rb', line 91 def ==(other) @operator = :equal @right = other self end |
#>(other) ⇒ Object
116 117 118 119 120 |
# File 'lib/aix/errlog/match.rb', line 116 def >(other) @operator = :gt @right = other self end |
#>=(other) ⇒ Object
121 122 123 124 125 |
# File 'lib/aix/errlog/match.rb', line 121 def >=(other) @operator = :ge @right = other self end |
#^(other) ⇒ Object
140 141 142 143 144 145 146 |
# File 'lib/aix/errlog/match.rb', line 140 def ^(other) Match.new( left: self, operator: :xor, right: other, ) end |
#include?(other) ⇒ Boolean
101 102 103 104 105 |
# File 'lib/aix/errlog/match.rb', line 101 def include?(other) @operator = :substr @right = other self end |
#to_struct ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/aix/errlog/match.rb', line 56 def to_struct raise "operator must be a symbol, but is #{@operator}" unless @operator.is_a? Symbol # We want to be sure the struct is not garbage collected before it's # used, so we need to retain a reference to it that ensures that it will # live as long as this object @struct = Lib::ErrlogMatch.new @struct[:em_op] = @operator case @left when Match @struct[:emu1][:emu_left] = @left.to_struct when Symbol @struct[:emu1][:emu_field] = @left else raise "left should be either a Match or Symbol object, but is #{@left}" end case @right when Match @struct[:emu2][:emu_right] = @right.to_struct when String @struct[:emu2][:emu_strvalue] = @right when Numeric, Time @struct[:emu2][:emu_intvalue] = @right.to_i when DateTime @struct[:emu2][:emu_intvalue] = @right.to_time.to_i else raise "left should be either a Match or Symbol object, but is #{@left}" end @struct end |