Class: Bpfql::Query::FilterOption
- Inherits:
-
Struct
- Object
- Struct
- Bpfql::Query::FilterOption
- Defined in:
- lib/bpfql/query.rb
Instance Attribute Summary collapse
-
#lhs ⇒ Object
Returns the value of attribute lhs.
-
#op ⇒ Object
Returns the value of attribute op.
-
#rhs ⇒ Object
Returns the value of attribute rhs.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(lhs, op = nil, rhs = nil) ⇒ FilterOption
constructor
A new instance of FilterOption.
Constructor Details
#initialize(lhs, op = nil, rhs = nil) ⇒ FilterOption
Returns a new instance of FilterOption.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/bpfql/query.rb', line 79 def initialize(lhs, op=nil, rhs=nil) if !rhs # args.size < 3 m = /^([^\s]+)\s+([^\s]+)\s+([^\s]+|"[^"]+"|'[^']+')$/.match(lhs) unless m raise "Failed to parse where clause: #{lhs}" end if m2 = /^['"](.+)['"]$/.match(m[3]) rhs = m2[1] else rhs = m[3] end super(m[1], m[2].to_sym, rhs) else super(lhs, op.to_sym, rhs) end end |
Instance Attribute Details
#lhs ⇒ Object
Returns the value of attribute lhs
71 72 73 |
# File 'lib/bpfql/query.rb', line 71 def lhs @lhs end |
#op ⇒ Object
Returns the value of attribute op
71 72 73 |
# File 'lib/bpfql/query.rb', line 71 def op @op end |
#rhs ⇒ Object
Returns the value of attribute rhs
71 72 73 |
# File 'lib/bpfql/query.rb', line 71 def rhs @rhs end |
Class Method Details
.parse(where) ⇒ Object
72 73 74 75 76 77 |
# File 'lib/bpfql/query.rb', line 72 def self.parse(where) where_list = Array(where) where_list.map do |whr| FilterOption.new(*whr) end end |