Class: Skeem::SkmNumber

Inherits:
SkmSimpleDatum show all
Defined in:
lib/skeem/skm_simple_datum.rb

Overview

class

Direct Known Subclasses

SkmReal

Instance Attribute Summary

Attributes inherited from SkmSimpleDatum

#token, #value

Attributes inherited from SkmElement

#position

Instance Method Summary collapse

Methods inherited from SkmSimpleDatum

#==, #accept, create, #done!, #evaluate, #init_value, #initialize, #position, #quasiquote, #symbol, #verbatim?

Methods inherited from SkmElement

#accept, #boolean?, #bound!, #callable?, #char?, #done!, #evaluate, #initialize, #inspect, #integer?, #list?, #null?, #pair?, #procedure?, #quasiquote, #quoted!, #rational?, #real?, #skm_eq?, #skm_equal?, #string?, #symbol?, #unquoted!, #vector?, #verbatim?

Constructor Details

This class inherits a constructor from Skeem::SkmSimpleDatum

Instance Method Details

#complex?Boolean



104
105
106
# File 'lib/skeem/skm_simple_datum.rb', line 104

def complex?
  false
end

#eqv?(other) ⇒ Boolean

rubocop: disable Style/NegatedIfElseCondition



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/skeem/skm_simple_datum.rb', line 110

def eqv?(other)
  return true if equal?(other)

  if other.kind_of?(SkmNumber)
    if exact? != other.exact?
      false
    else
      value == other.value
    end
  else
    value == other
  end
end

#number?Boolean



100
101
102
# File 'lib/skeem/skm_simple_datum.rb', line 100

def number?
  true
end