Class: Bpfql::Query
- Inherits:
-
Object
- Object
- Bpfql::Query
- Defined in:
- lib/bpfql/query.rb
Defined Under Namespace
Classes: FilterOption, ProbeOption, SelectOption, StopOption
Instance Attribute Summary collapse
-
#from ⇒ Object
(also: #probe)
Returns the value of attribute from.
-
#group_by ⇒ Object
Returns the value of attribute group_by.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#select ⇒ Object
Returns the value of attribute select.
-
#stop ⇒ Object
Returns the value of attribute stop.
-
#where ⇒ Object
Returns the value of attribute where.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&b) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(&b) ⇒ Query
Returns a new instance of Query.
23 24 25 |
# File 'lib/bpfql/query.rb', line 23 def initialize(&b) b.call(self) if b end |
Instance Attribute Details
#from ⇒ Object Also known as: probe
Returns the value of attribute from.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def from @from end |
#group_by ⇒ Object
Returns the value of attribute group_by.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def group_by @group_by end |
#interval ⇒ Object
Returns the value of attribute interval.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def interval @interval end |
#select ⇒ Object
Returns the value of attribute select.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def select @select end |
#stop ⇒ Object
Returns the value of attribute stop.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def stop @stop end |
#where ⇒ Object
Returns the value of attribute where.
26 27 28 |
# File 'lib/bpfql/query.rb', line 26 def where @where end |
Class Method Details
.parse_yaml(yaml) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bpfql/query.rb', line 5 def self.parse_yaml(yaml) data = YAML.load(yaml) data['BPFQL'].map do |query| Query.new do |builder| builder.select = SelectOption.new(query['select']) builder.from = ProbeOption.new(query['from']) if query['where'] builder.where = FilterOption.parse(query['where']) end builder.group_by = query['group_by'] # Accepts nil builder.interval = query['interval'] # Accepts nil if query['stop_after'] builder.stop = StopOption.new(:after, query['stop_after']) end end end end |