Class: Bpfql::Query::StopOption

Inherits:
Struct
  • Object
show all
Defined in:
lib/bpfql/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#secondsObject

Returns the value of attribute seconds

Returns:

  • (Object)

    the current value of seconds



97
98
99
# File 'lib/bpfql/query.rb', line 97

def seconds
  @seconds
end

#timingObject

Returns the value of attribute timing

Returns:

  • (Object)

    the current value of timing



97
98
99
# File 'lib/bpfql/query.rb', line 97

def timing
  @timing
end