Class: C::Literal

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

Instance Method Summary collapse

Instance Method Details

#csquare_keyObject



605
606
607
# File 'lib/csquare.rb', line 605

def csquare_key
  self.val
end

#depthObject



601
602
603
# File 'lib/csquare.rb', line 601

def depth
  0
end

#involves?(literal_or_variables) ⇒ Boolean

Returns:

  • (Boolean)


586
587
588
# File 'lib/csquare.rb', line 586

def involves? literal_or_variables
  literal_or_variables.is_a?(Array) ? literal_or_variables.include?(self.val) : literal_or_variables == self.val
end

#return_typename(function, blueprint) ⇒ Object

Raises:

  • (NotImplementedError)


594
595
596
597
598
599
# File 'lib/csquare.rb', line 594

def return_typename function, blueprint
  return :integer if val.is_a?(Fixnum)
  return :float   if val.is_a?(Float)
  return :string  if val.is_a?(String)
  raise(NotImplementedError, "unhandled literal type: #{self.inspect}")
end

#underlying_valueObject



590
591
592
# File 'lib/csquare.rb', line 590

def underlying_value
  self.val
end