Class: Bpfql::Query::StopOption
- Inherits:
-
Struct
- Object
- Struct
- Bpfql::Query::StopOption
- Defined in:
- lib/bpfql/query.rb
Instance Attribute Summary collapse
-
#seconds ⇒ Object
Returns the value of attribute seconds.
-
#timing ⇒ Object
Returns the value of attribute timing.
Instance Method Summary collapse
-
#initialize(timing, secstr) ⇒ StopOption
constructor
A new instance of StopOption.
Constructor Details
#initialize(timing, secstr) ⇒ StopOption
Returns a new instance of StopOption.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/bpfql/query.rb', line 98 def initialize(timing, secstr) seconds = 0 m = /^(\d+)(\w+)?$/.match(secstr.to_s) unless m raise "Failed to parse stop option clause: #{secstr}" end case m[2] when nil, /^s.*/ seconds = m[1].to_i when /^m.*/ seconds = m[1].to_i * 60 when /^h.*/ seconds = m[1].to_i * 60 * 60 end super(timing, seconds) end |
Instance Attribute Details
#seconds ⇒ Object
Returns the value of attribute seconds
97 98 99 |
# File 'lib/bpfql/query.rb', line 97 def seconds @seconds end |
#timing ⇒ Object
Returns the value of attribute timing
97 98 99 |
# File 'lib/bpfql/query.rb', line 97 def timing @timing end |