Class: PseudoBinding::PerlVar

Inherits:
String
  • Object
show all
Defined in:
lib/parsely.rb

Instance Method Summary collapse

Methods inherited from String

#value

Instance Method Details

#+(other) ⇒ Object

unneed as of now def coerce something

[something, to_f]

end



34
35
36
37
38
39
40
41
# File 'lib/parsely.rb', line 34

def + other
  case other
  when Numeric
    PerlVar.new((to_i + other).to_s)
  when String
    PerlVar.new((to_s + other).to_s)
  end
end

#<=>(other) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/parsely.rb', line 20

def <=> other
  if other.is_a? Numeric
    to_f <=> other
  else
    super
  end
end

#==(other) ⇒ Object

this is not defined in terms of <=>



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

def == other
  if other.is_a? Numeric
    to_f == other
  else
    super
  end
end

#inspectObject



27
28
29
# File 'lib/parsely.rb', line 27

def inspect
  "PerlVar(#{super})"
end