Class: ArbolHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/base.rb

Instance Method Summary collapse

Instance Method Details

#%(y) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/base.rb', line 45

def %(y)
  h = ArbolHash.new
  h[:type] = 'modulo'
  h[:op1] = self.to_h
  h[:op2] = resolve(y)
  h
end

#*(y) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/base.rb', line 29

def *(y)
  h = ArbolHash.new
  h[:type] = 'times'
  h[:op1] = self.to_h
  h[:op2] = resolve(y)
  h
end

#+(y) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/base.rb', line 13

def +(y)
  h = ArbolHash.new
  h[:type] = 'add'
  h[:op1] = self.to_h
  h[:op2] = resolve(y)
  h
end

#-(y) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/base.rb', line 21

def -(y)
  h = ArbolHash.new
  h[:type] = 'minus'
  h[:op1] = self.to_h
  h[:op2] = resolve(y)
  h
end

#/(y) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/base.rb', line 37

def /(y)
  h = ArbolHash.new
  h[:type] = 'divide'
  h[:op1] = self.to_h
  h[:op2] = resolve(y)
  h
end

#<(y) ⇒ Object



69
70
71
72
73
74
75
# File 'lib/base.rb', line 69

def <(y)
  h = ArbolHash.new
  h[:type] = 'less_than'
  h[:left] = self.to_h
  h[:right] = resolve(y)
  h
end

#<=(y) ⇒ Object



77
78
79
80
81
82
83
# File 'lib/base.rb', line 77

def <=(y)
  h = ArbolHash.new
  h[:type] = 'less_than_equals'
  h[:left] = self.to_h
  h[:right] = resolve(y)
  h
end

#>(y) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/base.rb', line 53

def >(y)
  h = ArbolHash.new
  h[:type] = 'greater_than'
  h[:left] = self.to_h
  h[:right] = resolve(y)
  h
end

#>=(y) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/base.rb', line 61

def >=(y)
  h = ArbolHash.new
  h[:type] = 'greater_than_equals'
  h[:left] = self.to_h
  h[:right] = resolve(y)
  h
end