Class: TraceVisualization::Data::Token

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_visualization/data/token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, int_value = -1)) ⇒ Token



13
14
15
# File 'lib/trace_visualization/data/token.rb', line 13

def initialize(name, value, int_value = -1)
  @name, @value, @int_value = name, value, int_value
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object



45
46
47
# File 'lib/trace_visualization/data/token.rb', line 45

def method_missing(name, *args, &blk)
  raise "Missing method #{name}" 
end

Instance Attribute Details

#int_valueObject

Returns the value of attribute int_value.



6
7
8
# File 'lib/trace_visualization/data/token.rb', line 6

def int_value
  @int_value
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/trace_visualization/data/token.rb', line 4

def name
  @name
end

#ordObject

Returns the value of attribute ord.



11
12
13
# File 'lib/trace_visualization/data/token.rb', line 11

def ord
  @ord
end

#token_lengthObject

Length of preprocessed string (see TOKEN_REGEXP)



9
10
11
# File 'lib/trace_visualization/data/token.rb', line 9

def token_length
  @token_length
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/trace_visualization/data/token.rb', line 5

def value
  @value
end

Instance Method Details

#<(other) ⇒ Object



25
26
27
# File 'lib/trace_visualization/data/token.rb', line 25

def <(other)
  @ord < other.ord
end

#<=>(anOther) ⇒ Object



21
22
23
# File 'lib/trace_visualization/data/token.rb', line 21

def <=>(anOther)
  @ord <=> anOther.ord
end

#lengthObject



17
18
19
# File 'lib/trace_visualization/data/token.rb', line 17

def length
  @value.length
end

#to_iObject



33
34
35
# File 'lib/trace_visualization/data/token.rb', line 33

def to_i
  to_int
end

#to_intObject



29
30
31
# File 'lib/trace_visualization/data/token.rb', line 29

def to_int
  @ord
end

#to_sObject



41
42
43
# File 'lib/trace_visualization/data/token.rb', line 41

def to_s
  to_str
end

#to_strObject



37
38
39
# File 'lib/trace_visualization/data/token.rb', line 37

def to_str
  @value
end