Class: Benelux::Range

Inherits:
Object show all
Includes:
Selectable::Object
Defined in:
lib/benelux/range.rb

Instance Attribute Summary collapse

Attributes included from Selectable::Object

#tags

Instance Method Summary collapse

Methods included from Selectable::Object

#add_tags, #add_tags_quick, #init_tags!, #remove_tags, #tag_values

Constructor Details

#initialize(name, from, to) ⇒ Range

Returns a new instance of Range.



10
11
12
13
# File 'lib/benelux/range.rb', line 10

def initialize(name,from,to)
  @name, @from, @to = name, from, to
  @tags = Selectable::Tags.new
end

Instance Attribute Details

#exceptionObject

Returns the value of attribute exception.



9
10
11
# File 'lib/benelux/range.rb', line 9

def exception
  @exception
end

#fromObject

Returns the value of attribute from.



7
8
9
# File 'lib/benelux/range.rb', line 7

def from
  @from
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/benelux/range.rb', line 6

def name
  @name
end

#toObject

Returns the value of attribute to.



8
9
10
# File 'lib/benelux/range.rb', line 8

def to
  @to
end

Instance Method Details

#<(other) ⇒ Object



43
44
45
# File 'lib/benelux/range.rb', line 43

def <(other)
  from < other
end

#<=>(other) ⇒ Object



40
41
42
# File 'lib/benelux/range.rb', line 40

def <=>(other)
  from <=> other.from
end

#>(other) ⇒ Object



46
47
48
# File 'lib/benelux/range.rb', line 46

def >(other)
  from > other
end

#call_idObject



28
29
30
# File 'lib/benelux/range.rb', line 28

def call_id
  @from.nil? ? :unknown : @from.call_id
end

#durationObject



37
38
39
# File 'lib/benelux/range.rb', line 37

def duration
  to - from
end

#failed?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/benelux/range.rb', line 34

def failed?
  !successful?
end

#inspectObject



17
18
19
20
# File 'lib/benelux/range.rb', line 17

def inspect
  args = [self.class, hexoid, duration, from, to, name, tags]
  "#<%s:%s duration=%0.4f from=%s to=%s name=%s %s>" % args
end

#successful?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/benelux/range.rb', line 31

def successful?
  @exception.nil?
end

#thread_idObject



25
26
27
# File 'lib/benelux/range.rb', line 25

def thread_id
  @from.nil? ? :unknown : @from.thread_id
end

#to_sObject



14
15
16
# File 'lib/benelux/range.rb', line 14

def to_s
  "%s:%.4f" % [name, duration]
end

#trackObject



22
23
24
# File 'lib/benelux/range.rb', line 22

def track 
  @from.nil? ? :unknown : @from.track
end